
public class ClassInspector extends Object
| Modifier and Type | Method and Description |
|---|---|
void |
collectAnnotatedMethods(Class<? extends Annotation> annotation,
List<JMethod> collection)
Collects the methods to find one annotated with the specified annotation.
|
void |
collectStaticAnnotatedFields(JClassType type,
JClassType typeParameter,
Class<? extends Annotation> annotation,
List<JField> collection)
Inspects the fields to collect the ones of the specified parameterized type with the specified
type as a parameter annotated with the specified annotation.
|
JMethod |
findAnnotatedMethod(Class<? extends Annotation> annotation)
Inspects the methods to find one annotated with the specified annotation.
|
JMethod |
findAnnotatedMethodWithoutParamsReturning(JClassType returnType,
Class<? extends Annotation> annotation,
boolean failIfAnnotationIsFoundOnWrongMethod)
Inspects the methods to find one that return the specified type and is annotated with the
specified annotation.
|
JMethod |
findMethod(String methodName,
JClassType parameterType)
Inspects the class for a method with the given name and taking exactly one parameter of the
specified type, or of a subtype of that type.
|
JMethod |
findMethodWithoutParamsReturning(JClassType returnType)
Inspects the methods to find one that return the specified type.
|
JMethod |
findMethodWithoutParamsReturning(JGenericType returnType,
JClassType returnTypeParameter)
Inspects the methods to find one that return the specified parameterized type with the
specified type as a parameter.
|
List<JMethod> |
getAllMethods()
Collects all methods from either the inspected class or any of its parent classes.
|
public JMethod findMethodWithoutParamsReturning(JClassType returnType) throws UnableToCompleteException
returnType - The type that should be returned by the method.returnType, or null if not found.UnableToCompleteException - If more than one matching method is found.public JMethod findMethodWithoutParamsReturning(JGenericType returnType, JClassType returnTypeParameter) throws UnableToCompleteException
returnType - The parameterized type that should be returned by the method.returnTypeParameter - The type parameter of returnType.returnType<returnTypeParameter>, or null if not
found.UnableToCompleteException - If more than one matching method is found.public JMethod findAnnotatedMethodWithoutParamsReturning(JClassType returnType, Class<? extends Annotation> annotation, boolean failIfAnnotationIsFoundOnWrongMethod) throws UnableToCompleteException
returnType - The type that should be returned by the method.annotation - The annotation that should be present on the method.failIfAnnotationIsFoundOnWrongMethod - If true, the call will throw an
UnableToCompleteException and log an error if the annotation is found on the
wrong method.returnType and annotated with annotation, or
null if not found.UnableToCompleteException - If more than one matching method is found, or if the
annotation is found on another method and failIfAnnotationIsFoundOnWrongMethod
is true.public JMethod findAnnotatedMethod(Class<? extends Annotation> annotation) throws UnableToCompleteException
annotation - The annotation that should be present on the method.annotation, or null if not found.UnableToCompleteException - If more than one matching method is found.public JMethod findMethod(String methodName, JClassType parameterType)
methodName - The name of the method to look for.parameterType - The type of the unique parameter accepted by that method.null if not found.public void collectAnnotatedMethods(Class<? extends Annotation> annotation, List<JMethod> collection)
annotation - The annotation that should be present on the methods.collection - The list in which to collect matching methods.public List<JMethod> getAllMethods()
public void collectStaticAnnotatedFields(JClassType type, JClassType typeParameter, Class<? extends Annotation> annotation, List<JField> collection) throws UnableToCompleteException
type - The parameterized type of the desired fields.typeParameter - The type parameter of type.annotation - The annotation that should be present on the field.collection - The list in which to collect matching fields.UnableToCompleteException - If a field annotated with annotation is found that
does not respect the other criteria of the search.Copyright © 2010-2014 ArcBees. All Rights Reserved.