Interface OptionRegistry<T extends Option<T>>
-
- Type Parameters:
T
- the upper bound of the options, which this registry handles
- All Known Implementing Classes:
ImmutableOptionRegistry
public interface OptionRegistry<T extends Option<T>>
Contains several options of a certain type. The framework can query for a certain type of option by the use of theget(Class)
method.An option registry must only contain one option per marker interfaces (which have to be sub interfaces of T, the type parameter of the option registry), so that the return value for
get(Class)
for each interface is uniquely defined.It is highly recommended, that instances of an option registry are immutable and serializable, since they will be passed along with tensoric expressions. To 'change' options for a certain environment, the
with(Option)
can be used, which has to return a new option registry, with all the same options, except the one which is marked by the marker interface of the passed in option.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T1 extends T>
T1get(java.lang.Class<T1> optionType)
Has to return the option with the given marker interface<T1 extends T>
OptionRegistry<T>with(T1 newOption)
Has to return a new instance of an option registry, containing the same options, except the given one replacing the previously contained option with the same marker interface.
-
-
-
Method Detail
-
get
<T1 extends T> T1 get(java.lang.Class<T1> optionType)
Has to return the option with the given marker interface- Parameters:
optionType
- the class of the marker interface for which an instance has to be retrieved- Returns:
- an instance of the option of the given class
-
with
<T1 extends T> OptionRegistry<T> with(T1 newOption)
Has to return a new instance of an option registry, containing the same options, except the given one replacing the previously contained option with the same marker interface.- Parameters:
newOption
- the new option to replace the previously contained with the same marker interface- Returns:
- a new instance of the option registry, containing also the new option
-
-