org.glassfish.hk2.internal
Class JaxRsClassAnalyzer

java.lang.Object
  extended by org.glassfish.hk2.internal.JaxRsClassAnalyzer
All Implemented Interfaces:
ClassAnalyzer

@Singleton
@Named(value="PreferLargestConstructor")
public class JaxRsClassAnalyzer
extends java.lang.Object
implements ClassAnalyzer

Implementation of the ClassAnalyzer that prefers the largest number of parameters in the constructor over the smallest. Other than that it is exactly the same as the default analyzer

Author:
jwells

Field Summary
 
Fields inherited from interface org.glassfish.hk2.api.ClassAnalyzer
DEFAULT_IMPLEMENTATION_NAME
 
Constructor Summary
JaxRsClassAnalyzer()
           
 
Method Summary
<T> java.lang.reflect.Constructor<T>
getConstructor(java.lang.Class<T> clazz)
          Will return the constructor that it to be used when constructing this service
<T> java.util.Set<java.lang.reflect.Field>
getFields(java.lang.Class<T> clazz)
          Will return the set of initializer fields to be used when initializing this service
<T> java.util.Set<java.lang.reflect.Method>
getInitializerMethods(java.lang.Class<T> clazz)
          Will return the set of initializer method to be used when initializing this service
<T> java.lang.reflect.Method
getPostConstructMethod(java.lang.Class<T> clazz)
          Will return the postConstruct method of the class
<T> java.lang.reflect.Method
getPreDestroyMethod(java.lang.Class<T> clazz)
          Will return the preDestroy method of the class
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JaxRsClassAnalyzer

public JaxRsClassAnalyzer()
Method Detail

getConstructor

public <T> java.lang.reflect.Constructor<T> getConstructor(java.lang.Class<T> clazz)
                                                throws MultiException,
                                                       java.lang.NoSuchMethodException
Description copied from interface: ClassAnalyzer
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

Specified by:
getConstructor in interface ClassAnalyzer
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 class
java.lang.NoSuchMethodException - if there was no available constructor

getInitializerMethods

public <T> java.util.Set<java.lang.reflect.Method> getInitializerMethods(java.lang.Class<T> clazz)
                                                              throws MultiException
Description copied from interface: ClassAnalyzer
Will return the set of initializer method to be used when initializing this service

The default implementation will return all methods marked with Inject

Specified by:
getInitializerMethods in interface ClassAnalyzer
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

public <T> java.util.Set<java.lang.reflect.Field> getFields(java.lang.Class<T> clazz)
                                                 throws MultiException
Description copied from interface: ClassAnalyzer
Will return the set of initializer fields to be used when initializing this service

The default implementation will return all fields marked with Inject

Specified by:
getFields in interface ClassAnalyzer
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

public <T> java.lang.reflect.Method getPostConstructMethod(java.lang.Class<T> clazz)
                                                throws MultiException
Description copied from interface: ClassAnalyzer
Will return the postConstruct method of the class

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

Specified by:
getPostConstructMethod in interface ClassAnalyzer
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

public <T> java.lang.reflect.Method getPreDestroyMethod(java.lang.Class<T> clazz)
                                             throws MultiException
Description copied from interface: ClassAnalyzer
Will return the preDestroy method of the class

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

Specified by:
getPreDestroyMethod in interface ClassAnalyzer
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


Copyright © 2013 Oracle Corporation. All Rights Reserved.