public abstract class AbstractBasicEnvironment<P extends BasicEnvironment> extends java.lang.Object implements BasicEnvironment
BasicEnvironment
interface, providing
default behaviours for most features.Modifier | Constructor and Description |
---|---|
protected |
AbstractBasicEnvironment(P parent)
Initializes me with the specified parent environment.
|
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.
|
P |
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.
|
boolean |
notOK(Option<ProblemHandler.Severity> option)
Queries whether I have a non-OK setting for the specified problem option.
|
<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.
|
protected void |
setParent(P parent)
Assigns me a parent environment after construction.
|
@Nullable protected P extends BasicEnvironment parent
protected AbstractBasicEnvironment(P parent)
parent
- an environment (or null
)@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
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
public final P getParent()
@Nullable 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 boolean notOK(@NonNull Option<ProblemHandler.Severity> option)
option
- the problem optionProblemHandler.Severity.OK
public <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 valueprotected void setParent(P parent)
null
if I previously had one.parent
- my new parent