public class SimpleOptionDefinition extends java.lang.Object implements OptionDefinition
OptionDefinition
interface.Constructor and Description |
---|
SimpleOptionDefinition(java.lang.String identifier,
java.lang.String description,
java.lang.Class type,
java.lang.Object defaultValue,
boolean required) |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getDefaultValue()
Returns a default value for the option.
|
java.lang.String |
getDescription() |
java.lang.String |
getIdentifier() |
java.lang.Class |
getType() |
boolean |
isRequired()
Returns
true if and only if this option is required. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getValue
public SimpleOptionDefinition(java.lang.String identifier, java.lang.String description, java.lang.Class type, java.lang.Object defaultValue, boolean required)
identifier
- short option identifierdescription
- user-friendly option descriptiontype
- the class of the values taken by this optiondefaultValue
- the default value. It must be an instance
of type
required
- whether this option is requiredpublic java.lang.String getIdentifier()
getIdentifier
in interface OptionDefinition
public java.lang.String getDescription()
getDescription
in interface OptionDefinition
public java.lang.Class getType()
getType
in interface OptionDefinition
public java.lang.Object getDefaultValue()
OptionDefinition
getType()
. The implementer
should return either an immutable value or a defensive copy.
null
is a valid return value, and is returned by the default
implementation. If this is a required option, the return value of this
method should never be used; in this case, null
is probably the
most appropriate value to return.getDefaultValue
in interface OptionDefinition
public boolean isRequired()
OptionDefinition
true
if and only if this option is required. The
default implementation returns false
.isRequired
in interface OptionDefinition
true
if this is a required (compulsory) option;
false
otherwise