Enum Class InstanceMode
- All Implemented Interfaces:
Serializable, Comparable<InstanceMode>, Constable, InstanceMetrics
The
InstanceMode describes how an instance for a Dependency
is managed (instantiated).-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAt least one instance is required and created in any case, not only when being demanded, though each time an instance is demanded(!)Each time an instance is demanded(!)Technically identical toSINGLETON_IS_MANDATORYwith emphasizing on the semantics of being a defaultDependency, usually used by (sub-classes of) theReactortype to emphasize that theDependencyis part of the implementation (singleton = yes, required = yes).Just a single instance is required and created in any case, not only when when demanded by other dependencies, no matter how often the instance is being demanded (singleton = yes, required = yes).Just a single instance is created on demanded(!) -
Method Summary
Modifier and TypeMethodDescriptionbooleanTrue in case aDependencyis required to be instantiated in any case, even if not being demanded by another dependency.booleanTrue in case theDependencyrepresents a singleton.static InstanceMetrics[]Retrieves allInstanceModeelements representing a required instances.static InstanceMetrics[]Retrieves allInstanceModeelements representing a singleton.static InstanceModeReturns the enum constant of this class with the specified name.static InstanceMode[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
SINGLETON_BY_DEFAULT
Technically identical toSINGLETON_IS_MANDATORYwith emphasizing on the semantics of being a defaultDependency, usually used by (sub-classes of) theReactortype to emphasize that theDependencyis part of the implementation (singleton = yes, required = yes). -
SINGLETON_IS_MANDATORY
Just a single instance is required and created in any case, not only when when demanded by other dependencies, no matter how often the instance is being demanded (singleton = yes, required = yes). -
INSTANCE_IS_MANDATORY
At least one instance is required and created in any case, not only when being demanded, though each time an instance is demanded(!) by other dependencies, a new instance is returned (the first time an instance is demanded, the initially created instance is injected, singleton = false, required = yes). -
SINGLETON_ON_DEMAND
Just a single instance is created on demanded(!) by other dependencies, no matter how often the instance is being demanded (singleton = yes, required = no). -
INSTANCE_ON_DEMAND
Each time an instance is demanded(!) by other dependencies, a new instance is returned (singleton = no, required = no).
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
isSingleton
public boolean isSingleton()True in case theDependencyrepresents a singleton.- Specified by:
isSingletonin interfaceInstanceMetrics- Returns:
- True in case of being a singleton
Dependency.
-
isMandatory
public boolean isMandatory()True in case aDependencyis required to be instantiated in any case, even if not being demanded by another dependency.- Specified by:
isMandatoryin interfaceInstanceMetrics- Returns:
- True in case of being a required
Dependency.
-
toSingletonModes
Retrieves allInstanceModeelements representing a singleton.- Returns:
- The singleton elements.
-
toRequiredModes
Retrieves allInstanceModeelements representing a required instances.- Returns:
- The required instances elements.
-