java.lang.Object
org.refcodes.decoupling.Context
- All Implemented Interfaces:
DependenciesAccessor
,org.refcodes.mixin.Schemable
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.decoupling.DependenciesAccessor
DependenciesAccessor.DependenciesBuilder<T,
B extends DependenciesAccessor.DependenciesBuilder<T, B>>, DependenciesAccessor.DependenciesMutator<T>, DependenciesAccessor.DependenciesProperty<T> -
Constructor Summary
ModifierConstructorDescriptionprotected
Empty constructor to be used in conjunction with theinitialize(Dependency[])
method!.Context
(Dependency<?>[] aDependencies, Object[] aProfiles) Creates theContext
with the managedDependency
instances. -
Method Summary
Modifier and TypeMethodDescriptionDependency<?>[]
Retrieves theDependency
declarations contained in theContext
.Dependency<?>[]
getDependenciesByProfiles
(Object... aProfiles) Retrieves theDependency
declarations of given profiles managed by thisContext
, derived from theDependency
Dependency
declarations from which theReactor
created thisContext
.Dependency<?>[]
getDependenciesByTags
(Object... aTags) Retrieves theDependency
declarations of given tags managed by thisContext
, derived from theDependency
Dependency
declarations from which theReactor
created thisContext
.<T> Dependency<T>[]
getDependenciesByType
(Class<T> aType) Retrieves theDependency
declarations of the given type managed by thisContext
, derived from theDependency
declarations from which theReactor
created thisContext
.Dependency<?>
getDependencyByAlias
(String aAlias) Retrieves theDependency
declaration with the given alias managed by thisContext
, derived from theDependency
Dependency
declaration from which theReactor
created thisContext
.Dependency<?>
getDependencyByInstance
(Object aInstance) Determines theDependency
element for the given instance created from theDependency
.<T> T
getFirstByType
(Class<T> aType) Retrieves the first instance of the given type managed by thisContext
, derived from theDependency
declarations from which theReactor
created thisContext
.Object[]
Retrieves the instances managed by thisContext
, derived from theDependency
declarations from which theReactor
created thisContext
.Object[]
getInstancesByAlias
(String aAlias) Retrieves the instances with the given alias managed by thisContext
, derived from theDependency
declarations from which theReactor
created thisContext
.Object[]
getInstancesByProfiles
(Object... aProfiles) Retrieves the instances of given profiles managed by thisContext
, derived from theDependency
declarations from which theReactor
created thisContext
.Object[]
getInstancesByTags
(Object... aTags) Retrieves the instances of given tags managed by thisContext
, derived from theDependency
declarations from which theReactor
created thisContext
.<T> T[]
getInstancesByType
(Class<T> aType) Retrieves the instances of the given type managed by thisContext
, derived from theDependency
declarations from which theReactor
created thisContext
.Object[]
Retrieves the The profiles which have been applied when creating thisContext
.getSingletonByAlias
(String aAlias) Retrieves the instances created by aDependency
havingInstanceMetrics
withInstanceMetrics.isSingleton()
being true (e.g.<T> T
getSingletonByAlias
(String aAlias, Class<T> aType) Retrieves the instances created by aDependency
havingInstanceMetrics
withInstanceMetrics.isSingleton()
being true (e.g.toSchema()
-
Constructor Details
-
Context
Empty constructor to be used in conjunction with theinitialize(Dependency[])
method!.- Parameters:
aProfiles
- The profiles which have been applied when creating thisContext
.
-
Context
Creates theContext
with the managedDependency
instances.- Parameters:
aDependencies
- TheDependency
declarations of which theContext
consists.aProfiles
- The profiles which have been applied when creating thisContext
.
-
-
Method Details
-
getProfiles
Retrieves the The profiles which have been applied when creating thisContext
.- Returns:
- The according profiles.
-
getDependencies
Retrieves theDependency
declarations contained in theContext
.- Specified by:
getDependencies
in interfaceDependenciesAccessor
- Returns:
- The
Dependency
declarations of which theContext
consists.
-
getDependencyByInstance
Determines theDependency
element for the given instance created from theDependency
.- Parameters:
aInstance
- The instance which'sDependency
element creating this instance is to be retrieved.- Returns:
- The according
Dependency
element or null if noneDependency
element is responsible for crating the provided instance.
-
getDependencyByAlias
Retrieves theDependency
declaration with the given alias managed by thisContext
, derived from theDependency
Dependency
declaration from which theReactor
created thisContext
.- Parameters:
aAlias
- The alias ofDependency
declaration to retrieve.- Returns:
- The according
Dependency
declaration managed by thisContext
.
-
getDependenciesByType
Retrieves theDependency
declarations of the given type managed by thisContext
, derived from theDependency
declarations from which theReactor
created thisContext
.- Type Parameters:
T
- the generic type- Parameters:
aType
- The type ofDependency
declarations to retrieve.- Returns:
- The according
Dependency
declarations managed by thisContext
.
-
getDependenciesByTags
Retrieves theDependency
declarations of given tags managed by thisContext
, derived from theDependency
Dependency
declarations from which theReactor
created thisContext
.- Parameters:
aTags
- The tags of theDependency
declarations to retrieve.- Returns:
- The according
Dependency
declarations managed by thisContext
.
-
getDependenciesByProfiles
Retrieves theDependency
declarations of given profiles managed by thisContext
, derived from theDependency
Dependency
declarations from which theReactor
created thisContext
.- Parameters:
aProfiles
- The profiles of theDependency
declarations to retrieve.- Returns:
- The according
Dependency
declarations managed by thisContext
.
-
getInstances
Retrieves the instances managed by thisContext
, derived from theDependency
declarations from which theReactor
created thisContext
.- Returns:
- The instances managed by this
Context
.
-
getSingletonByAlias
Retrieves the instances created by aDependency
havingInstanceMetrics
withInstanceMetrics.isSingleton()
being true (e.g.InstanceMode.SINGLETON_IS_MANDATORY
orInstanceMode.SINGLETON_ON_DEMAND
) and with the given alias managed by thisContext
, derived from theDependency
instances from which theReactor
created thisContext
.- Parameters:
aAlias
- The alias of instances to retrieve.- Returns:
- The according instances managed by this
Context
.
-
getSingletonByAlias
Retrieves the instances created by aDependency
havingInstanceMetrics
withInstanceMetrics.isSingleton()
being true (e.g.InstanceMode.SINGLETON_IS_MANDATORY
orInstanceMode.SINGLETON_ON_DEMAND
) and with the given alias managed by thisContext
, derived from theDependency
instances from which theReactor
created thisContext
.- Type Parameters:
T
- The type of the instance to be retrieved.- Parameters:
aAlias
- The alias of instances to retrieve.aType
- The type of the instance to retrieve.- Returns:
- The according instances managed by this
Context
.
-
getInstancesByAlias
Retrieves the instances with the given alias managed by thisContext
, derived from theDependency
declarations from which theReactor
created thisContext
.- Parameters:
aAlias
- The alias of instances to retrieve.- Returns:
- The according instances managed by this
Context
.
-
getInstancesByType
Retrieves the instances of the given type managed by thisContext
, derived from theDependency
declarations from which theReactor
created thisContext
.- Type Parameters:
T
- the generic type- Parameters:
aType
- The type of instances to retrieve.- Returns:
- The according instances managed by this
Context
.
-
getFirstByType
Retrieves the first instance of the given type managed by thisContext
, derived from theDependency
declarations from which theReactor
created thisContext
.- Type Parameters:
T
- the generic type- Parameters:
aType
- The type of instance to retrieve.- Returns:
- The according first instance managed by this
Context
or null if there is none.
-
getInstancesByTags
Retrieves the instances of given tags managed by thisContext
, derived from theDependency
declarations from which theReactor
created thisContext
.- Parameters:
aTags
- The tags of the instances to retrieve.- Returns:
- The according instances managed by this
Context
.
-
getInstancesByProfiles
Retrieves the instances of given profiles managed by thisContext
, derived from theDependency
declarations from which theReactor
created thisContext
.- Parameters:
aProfiles
- The profiles of the instances to retrieve.- Returns:
- The according instances managed by this
Context
.
-
toSchema
- Specified by:
toSchema
in interfaceorg.refcodes.mixin.Schemable
-