Class ClassDependenciesManager
- java.lang.Object
-
- net.officefloor.plugin.clazz.dependency.ClassDependenciesManager
-
- All Implemented Interfaces:
ClassDependencies
public class ClassDependenciesManager extends java.lang.Object implements ClassDependencies
ManagesClass
dependencies.- Author:
- Daniel Sagenschneider
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addClassDependencyManufacturer(ClassDependencyManufacturer manufacturer)
Adds an additionalClassDependencyManufacturer
.<E extends java.lang.Throwable>
voidaddEscalation(java.lang.Class<E> escalationType)
Allow registering an additionalEscalation
.static ClassDependenciesManager
create(java.lang.Class<?> clazz, SourceContext sourceContext, ClassDependenciesContext dependenciesContext)
ClassDependencyFactory
createClassDependencyFactory(java.lang.reflect.Executable executable, int parameterIndex, java.lang.String qualifier)
ClassDependencyFactory
createClassDependencyFactory(java.lang.reflect.Field field, java.lang.String qualifier)
Creates theClassDependencyFactory
for aField
.ClassDependencyFactory
createClassDependencyFactory(java.lang.String dependencyName, java.lang.Class<?> dependencyType, java.lang.String qualifier)
Creates aClassDependencyFactory
of a particularClass
.static ClassItemIndex
createClassItemIndex(int index, java.util.function.Consumer<java.lang.Object> annotationAdder)
Creates aClassItemIndex
.static ClassDependenciesManager
createNoObjects(java.lang.Class<?> clazz, SourceContext sourceContext, ClassDependenciesFlowContext flowsContext)
static java.lang.String
getDependencyName(java.lang.String qualifier, java.lang.Class<?> objectType)
Obtains the name of the dependency.static boolean
isSameArgumentType(java.lang.Class<?> argumentTypeA, java.lang.Class<?> argumentTypeB)
Determines if same argument type.static boolean
isSameObjectType(java.lang.Class<?> objectTypeA, java.lang.Class<?> objectTypeB)
Determines if same object type.static boolean
isSameQualifier(java.lang.String qualifierA, java.lang.String qualifierB)
Determines if same qualifier.void
loadManagedObjectExecuteContext(ManagedObjectExecuteContext<Indexed> executeContext)
Loads theManagedObjectExecuteContext
to the createdClassDependencyFactory
instances.
-
-
-
Method Detail
-
create
public static ClassDependenciesManager create(java.lang.Class<?> clazz, SourceContext sourceContext, ClassDependenciesContext dependenciesContext)
- Parameters:
clazz
-Class
being interrogated for injection.sourceContext
-SourceContext
.dependenciesContext
-ClassDependenciesContext
.
-
createNoObjects
public static ClassDependenciesManager createNoObjects(java.lang.Class<?> clazz, SourceContext sourceContext, ClassDependenciesFlowContext flowsContext)
- Parameters:
clazz
-Class
being interrogated for injection.sourceContext
-SourceContext
.flowsContext
-ClassDependenciesFlowContext
.
-
createClassItemIndex
public static ClassItemIndex createClassItemIndex(int index, java.util.function.Consumer<java.lang.Object> annotationAdder)
Creates aClassItemIndex
.- Parameters:
index
- Index of item.annotationAdder
- Adds additional annotations. May benull
.- Returns:
- Created
ClassItemIndex
.
-
isSameObjectType
public static boolean isSameObjectType(java.lang.Class<?> objectTypeA, java.lang.Class<?> objectTypeB)
Determines if same object type.- Parameters:
objectTypeA
- First object type.objectTypeB
- Second object type.- Returns:
true
if same.
-
isSameArgumentType
public static boolean isSameArgumentType(java.lang.Class<?> argumentTypeA, java.lang.Class<?> argumentTypeB)
Determines if same argument type.- Parameters:
argumentTypeA
- First argument type.argumentTypeB
- Second argument type.- Returns:
true
if same (or no argument).
-
isSameQualifier
public static boolean isSameQualifier(java.lang.String qualifierA, java.lang.String qualifierB)
Determines if same qualifier.- Parameters:
qualifierA
- First qualifier.qualifierB
- Second qualifier.- Returns:
true
if same qualifier (or no qualification).
-
getDependencyName
public static java.lang.String getDependencyName(java.lang.String qualifier, java.lang.Class<?> objectType)
Obtains the name of the dependency.- Parameters:
qualifier
- Qualifier. May benull
.objectType
- Dependency type.- Returns:
- Name for the dependency.
-
addClassDependencyManufacturer
public void addClassDependencyManufacturer(ClassDependencyManufacturer manufacturer)
Adds an additionalClassDependencyManufacturer
.- Parameters:
manufacturer
- AdditionalClassDependencyManufacturer
.
-
addEscalation
public <E extends java.lang.Throwable> void addEscalation(java.lang.Class<E> escalationType)
Allow registering an additionalEscalation
.- Type Parameters:
E
-Escalation
type.- Parameters:
escalationType
-Escalation
type.
-
loadManagedObjectExecuteContext
public void loadManagedObjectExecuteContext(ManagedObjectExecuteContext<Indexed> executeContext)
Loads theManagedObjectExecuteContext
to the createdClassDependencyFactory
instances.- Parameters:
executeContext
-ManagedObjectExecuteContext
.
-
createClassDependencyFactory
public ClassDependencyFactory createClassDependencyFactory(java.lang.reflect.Field field, java.lang.String qualifier) throws java.lang.Exception
Description copied from interface:ClassDependencies
Creates theClassDependencyFactory
for aField
.- Specified by:
createClassDependencyFactory
in interfaceClassDependencies
- Parameters:
field
-Field
.qualifier
- Qualifier.- Returns:
ClassDependencyFactory
.- Throws:
java.lang.Exception
- If fails to create.
-
createClassDependencyFactory
public ClassDependencyFactory createClassDependencyFactory(java.lang.reflect.Executable executable, int parameterIndex, java.lang.String qualifier) throws java.lang.Exception
Description copied from interface:ClassDependencies
- Specified by:
createClassDependencyFactory
in interfaceClassDependencies
- Parameters:
executable
-Executable
.parameterIndex
- Index of theParameter
.qualifier
- Qualifier.- Returns:
ClassDependencyFactory
.- Throws:
java.lang.Exception
- If fails to create.
-
createClassDependencyFactory
public ClassDependencyFactory createClassDependencyFactory(java.lang.String dependencyName, java.lang.Class<?> dependencyType, java.lang.String qualifier) throws java.lang.Exception
Description copied from interface:ClassDependencies
Creates aClassDependencyFactory
of a particularClass
.- Specified by:
createClassDependencyFactory
in interfaceClassDependencies
- Parameters:
dependencyName
- Name of dependency.dependencyType
-Class
of the dependency.qualifier
- Qualifier.- Returns:
ClassDependencyFactory
.- Throws:
java.lang.Exception
- If fails to create.
-
-