public interface OptionDefinition
FileLoader
interface and accepts any options for
file loading, its getOptionDefinitions
method should return a list of
OptionDefinition
instances giving details of the expected options.
null
is treated as a valid value throughout the loader options API,
but classes implementing this interface may choose to disallow it.
FileLoader
Modifier and Type | Method and Description |
---|---|
default java.lang.Object |
getDefaultValue()
Returns a default value for the option.
|
java.lang.String |
getDescription() |
java.lang.String |
getIdentifier() |
java.lang.Class |
getType() |
default java.lang.Object |
getValue(java.util.Map<java.lang.String,java.lang.Object> optionMap)
Returns the value of this option in a supplied option map.
|
default boolean |
isRequired()
Returns
true if and only if this option is required. |
java.lang.String getIdentifier()
java.lang.String getDescription()
java.lang.Class getType()
default java.lang.Object getDefaultValue()
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.default boolean isRequired()
true
if and only if this option is required. The
default implementation returns false
.true
if this is a required (compulsory) option;
false
otherwisedefault java.lang.Object getValue(java.util.Map<java.lang.String,java.lang.Object> optionMap)
IllegalStateException
will be thrown (whether or not the default
value is used). If this option's identifier is not present as a key in
the supplied map, the default value will be returned. If the option map
is null, or if the option is present but has the wrong class, an
IllegalArgumentException
will be thrown. If the option is absent
from the option map and is a required option (as determined by
isRequired()
, a IllegalArgumentException
will be thrown.
If this method does return a value rather than throwing an exception,
that value is guaranteed to be an instance of the class returned by
getType()
, and may therefore be safely cast to that class. Note
that the returned value may be null
.optionMap
- a non-null map of option identifiers to values