- 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 LocalizablegetHelp()List<String>getNames()booleanisMandatory()booleanisOption()StringtoString()-
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- themandatoryflag.names- thenames.
-
-
Method Detail
-
getHelp
public Localizable getHelp()
- Specified by:
getHelpin interfaceCliProperty<V>- Returns:
- the
Localizabledescribing thisCliProperty.
-
getNames
public List<String> getNames()
- Specified by:
getNamesin interfaceCliProperty<V>- Returns:
- the
Listwith the names of this property (e.g. "--help" and "-h" for aCliOptionor "file" for a parameterCliValue). The first name from theListis the canonical name. Options may have additional names (aliases) while parameters must have exactly one name.
-
isOption
public boolean isOption()
- Specified by:
isOptionin interfaceCliProperty<V>- Returns:
trueif thisCliPropertyis an option (corresponds to aCliOption),falseotherwise (if a parameter).
-
isMandatory
public boolean isMandatory()
- Specified by:
isMandatoryin interfaceCliProperty<V>- Returns:
trueif required,falseotherwise.
-
-