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()
CustomizableclearOptions in interface Customizablepublic <T> T getAdapter(java.lang.Class<T> adapterType)
getAdapter in interface AdaptableT - the requested adapter interfaceadapterType - the requested adapter interfacenull
if this environment does not adapt to itpublic java.util.Map<Option<?>,java.lang.Object> getOptions()
CustomizablegetOptions in interface Customizablepublic final P getParent()
@Nullable
public <T> T getValue(@NonNull
Option<T> option)
CustomizablegetValue in interface Customizableoption - the option to querypublic boolean isEnabled(@NonNull
Option<java.lang.Boolean> option)
CustomizableisEnabled in interface Customizableoption - an optionpublic boolean notOK(@NonNull
Option<ProblemHandler.Severity> option)
option - the problem optionProblemHandler.Severity.OKpublic <T> void putOptions(@NonNull
java.util.Map<? extends Option<T>,? extends T> newOptions)
CustomizableputOptions in interface CustomizablenewOptions - the options@Nullable
public <T> T removeOption(@NonNull
Option<T> option)
CustomizableremoveOption in interface Customizableoption - the option to remove@NonNull public <T> java.util.Map<Option<T>,T> removeOptions(@NonNull java.util.Collection<Option<T>> unwantedOptions)
CustomizableremoveOptions in interface CustomizableunwantedOptions - the options to removepublic <T> void setOption(@NonNull
Option<T> option,
@Nullable
T value)
CustomizablesetOption in interface Customizableoption - the optionvalue - the option's valueprotected void setParent(P parent)
null if I previously had one.parent - my new parent