Class DefaultClassAnalyzer
- All Implemented Interfaces:
ClassAnalyzer
-
Field Summary
FieldsFields inherited from interface org.glassfish.hk2.api.ClassAnalyzer
DEFAULT_IMPLEMENTATION_NAME
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultClassAnalyzer
(ServiceLocatorImpl locator) The DefaultClassAnalyzer is per ServiceLocatorImpl -
Method Summary
Modifier and TypeMethodDescription<T> Constructor
<T> getConstructor
(Class<T> clazz) Will return the constructor that it to be used when constructing this serviceWill return the set of initializer fields to be used when initializing this servicegetInitializerMethods
(Class<T> clazz) Will return the set of initializer method to be used when initializing this service<T> Method
getPostConstructMethod
(Class<T> clazz) Will return the postConstruct method of the class<T> Method
getPreDestroyMethod
(Class<T> clazz) Will return the preDestroy method of the class
-
Field Details
-
locator
-
-
Constructor Details
-
DefaultClassAnalyzer
The DefaultClassAnalyzer is per ServiceLocatorImpl- Parameters:
locator
- The non-null locator associated with this analyzer
-
-
Method Details
-
getConstructor
public <T> Constructor<T> getConstructor(Class<T> clazz) throws MultiException, NoSuchMethodException Description copied from interface:ClassAnalyzer
Will return the constructor that it to be used when constructing this serviceThe default implementation will use the zero-arg constructor if no single constructor with Inject is found. Also will return any constructor that is covered by an
InjectionResolver
and theInjectionResolver.isConstructorParameterIndicator()
is set to true- Specified by:
getConstructor
in interfaceClassAnalyzer
- Parameters:
clazz
- the non-null class to analyze- Returns:
- The non-null constructor to use for creating this service
- Throws:
MultiException
- on an error when analyzing the classNoSuchMethodException
- if there was no available constructor
-
getInitializerMethods
Description copied from interface:ClassAnalyzer
Will return the set of initializer method to be used when initializing this serviceThe default implementation will return all methods marked with Inject or that have a parameter that is covered by an
InjectionResolver
and theInjectionResolver.isMethodParameterIndicator()
is set to true. Also, any method that has a parameter marked withSubscribeTo
will NOT be returned, as these methods are instead meant to be called when an event is fired- Specified by:
getInitializerMethods
in interfaceClassAnalyzer
- Parameters:
clazz
- the non-null class to analyze- Returns:
- A non-null but possibly empty set of initialization methods
- Throws:
MultiException
- on an error when analyzing the class
-
getFields
Description copied from interface:ClassAnalyzer
Will return the set of initializer fields to be used when initializing this serviceThe default implementation will return all fields marked with Inject or that have a parameter that is covered by an
InjectionResolver
- Specified by:
getFields
in interfaceClassAnalyzer
- Parameters:
clazz
- the non-null class to analyze- Returns:
- A non-null but possibly empty set of initialization fields
- Throws:
MultiException
- on an error when analyzing the class
-
getPostConstructMethod
Description copied from interface:ClassAnalyzer
Will return the postConstruct method of the classThe default implementation will return the
PostConstruct.postConstruct()
method or the method annotated with PostConstruct- Specified by:
getPostConstructMethod
in interfaceClassAnalyzer
- Parameters:
clazz
- the non-null class to analyze- Returns:
- A possibly null method representing the postConstruct method to call
- Throws:
MultiException
- on an error when analyzing the class
-
getPreDestroyMethod
Description copied from interface:ClassAnalyzer
Will return the preDestroy method of the classThe default implementation will return the
PreDestroy.preDestroy()
method or the method annotated with PreDestroy- Specified by:
getPreDestroyMethod
in interfaceClassAnalyzer
- Parameters:
clazz
- the non-null class to analyze- Returns:
- A possibly null method representing the preDestroy method to call
- Throws:
MultiException
- on an error when analyzing the class
-