public enum EchoOption extends Enum<EchoOption> implements Option, EchoOptions
echo
command.
For most applications, it may be more convenient to use Echo.Options
instead of the option constants defined here.
-n | --noNewline | Do not print the trailing newline character(s). |
EchoOptions.Default
Enum Constant and Description |
---|
noNewline
Option
--noNewline , -n :
Do not print the trailing newline character(s). |
CONVERTER, EMPTY
Modifier and Type | Method and Description |
---|---|
char |
acronym()
Returns a one letter acronym for this option.
|
EnumSet<EchoOption> |
asSet()
Returns a new set with
this active option. |
static EchoOption |
findByAcronym(char acronym)
Returns the option with the given
acronym , or null if no
such option is found. |
boolean |
isSet(EchoOption option)
Returns true if the specified
option is set and false otherwise |
Iterator<EchoOption> |
iterator()
Returns an immutable iterator returning o single element:
this
option. |
Class<EchoOption> |
optionType()
Returns the option type class, usually an enum.
|
int |
size()
Returns 1 as this is a set with a single element:
this option |
boolean |
useAcronymFor(EchoOption option)
Returns true if the
acronym should be used for
the specified option in string representations. |
static EchoOption |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static EchoOption[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
forEach, spliterator
public static final EchoOption noNewline
--noNewline
, -n
:
Do not print the trailing newline character(s).public static EchoOption[] values()
for (EchoOption c : EchoOption.values()) System.out.println(c);
public static EchoOption valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic Class<EchoOption> optionType()
OptionSet
optionType
in interface OptionSet<EchoOption>
public static EchoOption findByAcronym(char acronym)
acronym
, or null
if no
such option is found.acronym
- the option acronym
acronym
or null
if it
is not foundpublic char acronym()
Option
public boolean isSet(EchoOption option)
OptionSet
option
is set and false otherwiseisSet
in interface OptionSet<EchoOption>
option
- the option to testoption
is set in this OptionSet
public EnumSet<EchoOption> asSet()
this
active option.asSet
in interface OptionSet<EchoOption>
public Iterator<EchoOption> iterator()
this
option.iterator
in interface Iterable<EchoOption>
iterator
in interface OptionSet<EchoOption>
this
active option.public int size()
this
optionsize
in interface OptionSet<EchoOption>
public boolean useAcronymFor(EchoOption option)
acronym
should be used for
the specified option
in string representations.
This method returns always true for all options.
useAcronymFor
in interface OptionSet<EchoOption>
option
- the option of interestCopyright © 2024. All rights reserved.