public abstract class AbstractCustomizable extends java.lang.Object implements Adaptable, Customizable
Adaptable
and Customizable
interfaces,
providing some useful common behaviors. Implementors of metamodel-specific
environments are encourage to extend this class rather than implement
an evaluation environment "from scratch."
Constructor and Description |
---|
AbstractCustomizable() |
Modifier and Type | Method and Description |
---|---|
protected java.util.Map<Option<?>,java.lang.Object> |
basicGetOptions() |
java.util.Map<Option<?>,java.lang.Object> |
clearOptions()
Clears all options.
|
<T> T |
getAdapter(java.lang.Class<T> adapterType)
Implements the interface method by testing whether I am an instance of
the requested adapter type.
|
java.util.Map<Option<?>,java.lang.Object> |
getOptions()
Obtains a copy of my map of options.
|
protected abstract Customizable |
getParent() |
<T> T |
getValue(Option<T> option)
Obtains the value of the specified option's setting in the my
options map.
|
boolean |
isEnabled(Option<java.lang.Boolean> option)
Queries whether the specified boolean-valued option is enabled.
|
<T> void |
putOptions(java.util.Map<? extends Option<T>,? extends T> newOptions)
Adds options to apply to my behaviour.
|
<T> T |
removeOption(Option<T> option)
Removes the specified option.
|
<T> java.util.Map<Option<T>,T> |
removeOptions(java.util.Collection<Option<T>> unwantedOptions)
Removes the specified options.
|
<T> void |
setOption(Option<T> option,
T value)
Add an option to apply to my behaviour.
|
@NonNull protected final java.util.Map<Option<?>,java.lang.Object> basicGetOptions()
@NonNull public java.util.Map<Option<?>,java.lang.Object> clearOptions()
Customizable
clearOptions
in interface Customizable
@Nullable public <T> T getAdapter(java.lang.Class<T> adapterType)
getAdapter
in interface Adaptable
T
- the requested adapter interfaceadapterType
- the requested adapter interfacenull
if this environment does not adapt to itpublic java.util.Map<Option<?>,java.lang.Object> getOptions()
Customizable
getOptions
in interface Customizable
@Nullable protected abstract Customizable getParent()
public <T> T getValue(@NonNull Option<T> option)
Customizable
getValue
in interface Customizable
option
- the option to querypublic boolean isEnabled(@NonNull Option<java.lang.Boolean> option)
Customizable
isEnabled
in interface Customizable
option
- an optionpublic <T> void putOptions(@NonNull java.util.Map<? extends Option<T>,? extends T> newOptions)
Customizable
putOptions
in interface Customizable
newOptions
- the options@Nullable public <T> T removeOption(@NonNull Option<T> option)
Customizable
removeOption
in interface Customizable
option
- the option to remove@NonNull public <T> java.util.Map<Option<T>,T> removeOptions(@NonNull java.util.Collection<Option<T>> unwantedOptions)
Customizable
removeOptions
in interface Customizable
unwantedOptions
- the options to removepublic <T> void setOption(@NonNull Option<T> option, @Nullable T value)
Customizable
setOption
in interface Customizable
option
- the optionvalue
- the option's value