- java.lang.Object
-
- io.github.mmm.nls.cli.property.AbstractCliProperty<V>
-
- Type Parameters:
V
- type of the containedvalue
.
- All Implemented Interfaces:
CliProperty<V>
- Direct Known Subclasses:
CliBooleanProperty
,CliClassProperty
,CliCollectionProperty
,CliLocalDateProperty
,CliLocaleProperty
,CliLocalTimeProperty
,CliLongProperty
,CliStringProperty
public abstract class AbstractCliProperty<V> extends Object implements CliProperty<V>
Abstract base implementation ofCliProperty
.- Since:
- 1.0.0
-
-
Constructor Summary
Constructors Constructor Description AbstractCliProperty(Localizable help, boolean mandatory, String... names)
The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Localizable
getHelp()
List<String>
getNames()
boolean
isMandatory()
boolean
isOption()
String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.github.mmm.nls.cli.property.CliProperty
get, getAsString, getName, getValueClass, isEmpty, isValid, set, setFromString, validate
-
-
-
-
Constructor Detail
-
AbstractCliProperty
public AbstractCliProperty(Localizable help, boolean mandatory, String... names)
The constructor.- Parameters:
help
- thehelp message
.mandatory
- themandatory
flag.names
- thenames
.
-
-
Method Detail
-
getHelp
public Localizable getHelp()
- Specified by:
getHelp
in interfaceCliProperty<V>
- Returns:
- the
Localizable
describing thisCliProperty
.
-
getNames
public List<String> getNames()
- Specified by:
getNames
in interfaceCliProperty<V>
- Returns:
- the
List
with the names of this property (e.g. "--help" and "-h" for aCliOption
or "file" for a parameterCliValue
). The first name from theList
is the canonical name. Options may have additional names (aliases) while parameters must have exactly one name.
-
isOption
public boolean isOption()
- Specified by:
isOption
in interfaceCliProperty<V>
- Returns:
true
if thisCliProperty
is an option (corresponds to aCliOption
),false
otherwise (if a parameter).
-
isMandatory
public boolean isMandatory()
- Specified by:
isMandatory
in interfaceCliProperty<V>
- Returns:
true
if required,false
otherwise.
-
-