Class Context
java.lang.Object
org.refcodes.decoupling.Context
- All Implemented Interfaces:
DependenciesAccessor, Diagnosable, Schemable<DiagnosticOptions>
-
Nested Class Summary
Nested classes/interfaces inherited from interface DependenciesAccessor
DependenciesAccessor.DependenciesBuilder<T,B>, DependenciesAccessor.DependenciesMutator<T>, DependenciesAccessor.DependenciesProperty<T> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEmpty constructor to be used in conjunction with theinitialize(Dependency[])method!.Context(Dependency<?>[] aDependencies, Object[] aProfiles) Creates theContextwith the managedDependencyinstances. -
Method Summary
Modifier and TypeMethodDescriptionDependency<?>[]Retrieves theDependencydeclarations contained in theContext.Dependency<?>[]getDependenciesByProfiles(Object... aProfiles) Retrieves theDependencydeclarations of given profiles managed by thisContext, derived from theDependencyDependencydeclarations from which theReactorcreated thisContext.Dependency<?>[]getDependenciesByTags(Object... aTags) Retrieves theDependencydeclarations of given tags managed by thisContext, derived from theDependencyDependencydeclarations from which theReactorcreated thisContext.<T> Dependency<T>[]getDependenciesByType(Class<T> aType) Retrieves theDependencydeclarations of the given type managed by thisContext, derived from theDependencydeclarations from which theReactorcreated thisContext.Dependency<?> getDependencyByAlias(String aAlias) Retrieves theDependencydeclaration with the given alias managed by thisContext, derived from theDependencyDependencydeclaration from which theReactorcreated thisContext.Dependency<?> getDependencyByInstance(Object aInstance) Determines theDependencyelement for the given instance created from theDependency.<T> TgetFirstByType(Class<T> aType) Retrieves the first instance of the given type managed by thisContext, derived from theDependencydeclarations from which theReactorcreated thisContext.Object[]Retrieves the instances managed by thisContext, derived from theDependencydeclarations from which theReactorcreated thisContext.Object[]getInstancesByAlias(String aAlias) Retrieves the instances with the given alias managed by thisContext, derived from theDependencydeclarations from which theReactorcreated thisContext.Object[]getInstancesByProfiles(Object... aProfiles) Retrieves the instances of given profiles managed by thisContext, derived from theDependencydeclarations from which theReactorcreated thisContext.Object[]getInstancesByTags(Object... aTags) Retrieves the instances of given tags managed by thisContext, derived from theDependencydeclarations from which theReactorcreated thisContext.<T> T[]getInstancesByType(Class<T> aType) Retrieves the instances of the given type managed by thisContext, derived from theDependencydeclarations from which theReactorcreated thisContext.Object[]Retrieves the The profiles which have been applied when creating thisContext.getSingletonByAlias(String aAlias) Retrieves the instances created by aDependencyhavingInstanceMetricswithInstanceMetrics.isSingleton()being true (e.g.<T> TgetSingletonByAlias(String aAlias, Class<T> aType) Retrieves the instances created by aDependencyhavingInstanceMetricswithInstanceMetrics.isSingleton()being true (e.g.toSchema()
-
Constructor Details
-
Context
-
Context
Creates theContextwith the managedDependencyinstances.- Parameters:
aDependencies- TheDependencydeclarations of which theContextconsists.aProfiles- The profiles which have been applied when creating thisContext.
-
-
Method Details
-
getProfiles
-
getDependencies
Retrieves theDependencydeclarations contained in theContext.- Specified by:
getDependenciesin interfaceDependenciesAccessor- Returns:
- The
Dependencydeclarations of which theContextconsists.
-
getDependencyByInstance
Determines theDependencyelement for the given instance created from theDependency.- Parameters:
aInstance- The instance which'sDependencyelement creating this instance is to be retrieved.- Returns:
- The according
Dependencyelement or null if noneDependencyelement is responsible for crating the provided instance.
-
getDependencyByAlias
Retrieves theDependencydeclaration with the given alias managed by thisContext, derived from theDependencyDependencydeclaration from which theReactorcreated thisContext.- Parameters:
aAlias- The alias ofDependencydeclaration to retrieve.- Returns:
- The according
Dependencydeclaration managed by thisContext.
-
getDependenciesByType
Retrieves theDependencydeclarations of the given type managed by thisContext, derived from theDependencydeclarations from which theReactorcreated thisContext.- Type Parameters:
T- the generic type- Parameters:
aType- The type ofDependencydeclarations to retrieve.- Returns:
- The according
Dependencydeclarations managed by thisContext.
-
getDependenciesByTags
Retrieves theDependencydeclarations of given tags managed by thisContext, derived from theDependencyDependencydeclarations from which theReactorcreated thisContext.- Parameters:
aTags- The tags of theDependencydeclarations to retrieve.- Returns:
- The according
Dependencydeclarations managed by thisContext.
-
getDependenciesByProfiles
Retrieves theDependencydeclarations of given profiles managed by thisContext, derived from theDependencyDependencydeclarations from which theReactorcreated thisContext.- Parameters:
aProfiles- The profiles of theDependencydeclarations to retrieve.- Returns:
- The according
Dependencydeclarations managed by thisContext.
-
getInstances
-
getSingletonByAlias
Retrieves the instances created by aDependencyhavingInstanceMetricswithInstanceMetrics.isSingleton()being true (e.g.InstanceMode.SINGLETON_IS_MANDATORYorInstanceMode.SINGLETON_ON_DEMAND) and with the given alias managed by thisContext, derived from theDependencyinstances from which theReactorcreated thisContext.- Parameters:
aAlias- The alias of instances to retrieve.- Returns:
- The according instances managed by this
Context.
-
getSingletonByAlias
Retrieves the instances created by aDependencyhavingInstanceMetricswithInstanceMetrics.isSingleton()being true (e.g.InstanceMode.SINGLETON_IS_MANDATORYorInstanceMode.SINGLETON_ON_DEMAND) and with the given alias managed by thisContext, derived from theDependencyinstances from which theReactorcreated 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 theDependencydeclarations from which theReactorcreated 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 theDependencydeclarations from which theReactorcreated 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 theDependencydeclarations from which theReactorcreated thisContext.- Type Parameters:
T- the generic type- Parameters:
aType- The type of instance to retrieve.- Returns:
- The according first instance managed by this
Contextor null if there is none.
-
getInstancesByTags
Retrieves the instances of given tags managed by thisContext, derived from theDependencydeclarations from which theReactorcreated 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 theDependencydeclarations from which theReactorcreated thisContext.- Parameters:
aProfiles- The profiles of the instances to retrieve.- Returns:
- The according instances managed by this
Context.
-
toSchema
- Specified by:
toSchemain interfaceSchemable<DiagnosticOptions>
-