Top Description Fields Constructors Methods
org.jvnet.hk2.internal

public Class DefaultClassAnalyzer

extends Object
implements ClassAnalyzer
Class Inheritance
All Implemented Interfaces
org.glassfish.hk2.api.ClassAnalyzer
Annotations
@Singleton
@Named:default
@Visibility:LOCAL
Imports
java.lang.reflect.Constructor, .Field, .Method, java.util.Set, jakarta.inject.Named, .Singleton, org.glassfish.hk2.api.ClassAnalyzer, .DescriptorVisibility, .MultiException, .Visibility

this is the default implementation of the ClassAnalyzer
Author
jwells

Field Summary

Modifier and TypeField and Description
private final ServiceLocatorImpl

Constructor Summary

AccessConstructor and Description
public
DefaultClassAnalyzer(ServiceLocatorImpl
The non-null locator associated with this analyzer
locator
)

The DefaultClassAnalyzer is per ServiceLocatorImpl

Method Summary

Modifier and TypeMethod and Description
public <T> Constructor<T>
getConstructor(Class<T> clazz)

Implements org.glassfish.hk2.api.ClassAnalyzer.getConstructor.

Will return the constructor that it to be used when constructing this service

The default implementation will use the zero-arg constructor if no single constructor with Inject is found.

public <T> Set<Field>
getFields(Class<T> clazz)

Implements org.glassfish.hk2.api.ClassAnalyzer.getFields.

Will return the set of initializer fields to be used when initializing this service

The default implementation will return all fields marked with Inject or that have a parameter that is covered by an InjectionResolver

public <T> Set<Method>
getInitializerMethods(Class<T> clazz)

Implements org.glassfish.hk2.api.ClassAnalyzer.getInitializerMethods.

Will return the set of initializer method to be used when initializing this service

The default implementation will return all methods marked with Inject or that have a parameter that is covered by an InjectionResolver and the InjectionResolver#isMethodParameterIndicator() is set to true.

public <T> Method
getPostConstructMethod(Class<T> clazz)

Implements org.glassfish.hk2.api.ClassAnalyzer.getPostConstructMethod.

Will return the postConstruct method of the class

The default implementation will return the PostConstruct#postConstruct() method or the method annotated with PostConstruct

public <T> Method
getPreDestroyMethod(Class<T> clazz)

Implements org.glassfish.hk2.api.ClassAnalyzer.getPreDestroyMethod.

Will return the preDestroy method of the class

The default implementation will return the PreDestroy#preDestroy() method or the method annotated with PreDestroy

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

locatorback to summary
private final ServiceLocatorImpl locator

Constructor Detail

DefaultClassAnalyzerback to summary
public DefaultClassAnalyzer(ServiceLocatorImpl locator)

The DefaultClassAnalyzer is per ServiceLocatorImpl

Parameters
locator:ServiceLocatorImpl

The non-null locator associated with this analyzer

Method Detail

getConstructorback to summary
public <T> Constructor<T> getConstructor(Class<T> clazz) throws MultiException, NoSuchMethodException

Implements org.glassfish.hk2.api.ClassAnalyzer.getConstructor.

Doc from org.glassfish.hk2.api.ClassAnalyzer.getConstructor.

Will return the constructor that it to be used when constructing this service

The 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 the InjectionResolver#isConstructorParameterIndicator() is set to true

Annotations
@SuppressWarnings:unchecked
@Override
Exceptions
MultiException:
on an error when analyzing the class
NoSuchMethodException:
if there was no available constructor
getFieldsback to summary
public <T> Set<Field> getFields(Class<T> clazz) throws MultiException

Implements org.glassfish.hk2.api.ClassAnalyzer.getFields.

Doc from org.glassfish.hk2.api.ClassAnalyzer.getFields.

Will return the set of initializer fields to be used when initializing this service

The default implementation will return all fields marked with Inject or that have a parameter that is covered by an InjectionResolver

Annotations
@Override
Exceptions
MultiException:
on an error when analyzing the class
getInitializerMethodsback to summary
public <T> Set<Method> getInitializerMethods(Class<T> clazz) throws MultiException

Implements org.glassfish.hk2.api.ClassAnalyzer.getInitializerMethods.

Doc from org.glassfish.hk2.api.ClassAnalyzer.getInitializerMethods.

Will return the set of initializer method to be used when initializing this service

The default implementation will return all methods marked with Inject or that have a parameter that is covered by an InjectionResolver and the InjectionResolver#isMethodParameterIndicator() is set to true. Also, any method that has a parameter marked with org.glassfish.hk2.api.messaging.SubscribeTo will NOT be returned, as these methods are instead meant to be called when an event is fired

Annotations
@Override
Exceptions
MultiException:
on an error when analyzing the class
getPostConstructMethodback to summary
public <T> Method getPostConstructMethod(Class<T> clazz) throws MultiException

Implements org.glassfish.hk2.api.ClassAnalyzer.getPostConstructMethod.

Doc from org.glassfish.hk2.api.ClassAnalyzer.getPostConstructMethod.

Will return the postConstruct method of the class

The default implementation will return the PostConstruct#postConstruct() method or the method annotated with PostConstruct

Annotations
@Override
Exceptions
MultiException:
on an error when analyzing the class
getPreDestroyMethodback to summary
public <T> Method getPreDestroyMethod(Class<T> clazz) throws MultiException

Implements org.glassfish.hk2.api.ClassAnalyzer.getPreDestroyMethod.

Doc from org.glassfish.hk2.api.ClassAnalyzer.getPreDestroyMethod.

Will return the preDestroy method of the class

The default implementation will return the PreDestroy#preDestroy() method or the method annotated with PreDestroy

Annotations
@Override
Exceptions
MultiException:
on an error when analyzing the class