org.springframework.roo.classpath.details
Class MemberFindingUtils

java.lang.Object
  extended by org.springframework.roo.classpath.details.MemberFindingUtils

public abstract class MemberFindingUtils
extends Object

Utility methods for finding members in MemberHoldingTypeDetails instances.

Since:
1.0
Author:
Ben Alex

Constructor Summary
MemberFindingUtils()
           
 
Method Summary
static AnnotationMetadata getAnnotationOfType(List<? extends AnnotationMetadata> annotations, org.springframework.roo.model.JavaType type)
          Locates an annotation with the specified type from a list of annotations.
static ConstructorMetadata getDeclaredConstructor(MemberHoldingTypeDetails memberHoldingTypeDetails, List<org.springframework.roo.model.JavaType> parameters)
          Locates the specified constructor.
static FieldMetadata getDeclaredField(MemberHoldingTypeDetails memberHoldingTypeDetails, org.springframework.roo.model.JavaSymbolName fieldName)
          Locates the specified field.
static List<FieldMetadata> getDeclaredFields(MemberHoldingTypeDetails memberHoldingTypeDetails)
          Returns all declared fields
static MethodMetadata getDeclaredMethod(MemberHoldingTypeDetails memberHoldingTypeDetails, org.springframework.roo.model.JavaSymbolName methodName, List<org.springframework.roo.model.JavaType> parameters)
          Locates the specified method.
static AnnotationMetadata getDeclaredTypeAnnotation(MemberHoldingTypeDetails memberHoldingTypeDetails, org.springframework.roo.model.JavaType type)
          Locates the specified type-level annotation.
static FieldMetadata getField(ClassOrInterfaceTypeDetails classOrInterfaceTypeDetails, org.springframework.roo.model.JavaSymbolName fieldName)
          Searches up the inheritance hierarchy until the first field with the specified name is located.
static List<FieldMetadata> getFieldsWithAnnotation(ClassOrInterfaceTypeDetails classOrInterfaceTypeDetails, org.springframework.roo.model.JavaType annotation)
          Searches up the inheritance hierarchy and locates all declared fields which are annotated with the specified annotation.
static MethodMetadata getMethod(ClassOrInterfaceTypeDetails classOrInterfaceTypeDetails, org.springframework.roo.model.JavaSymbolName methodName, List<org.springframework.roo.model.JavaType> parameters)
          Searches up the inheritance hierarchy until the first method with the specified name and parameters is located.
static List<MethodMetadata> getMethods(ClassOrInterfaceTypeDetails classOrInterfaceTypeDetails)
          Locates all methods on this class and its superclasses.
static AnnotationMetadata getTypeAnnotation(ClassOrInterfaceTypeDetails classOrInterfaceTypeDetails, org.springframework.roo.model.JavaType annotationType)
          Locates an annotation on this class and its superclasses.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemberFindingUtils

public MemberFindingUtils()
Method Detail

getDeclaredField

public static final FieldMetadata getDeclaredField(MemberHoldingTypeDetails memberHoldingTypeDetails,
                                                   org.springframework.roo.model.JavaSymbolName fieldName)
Locates the specified field.

Parameters:
memberHoldingTypeDetails - the MemberHoldingTypeDetails to search (required)
fieldName - to locate (required)
Returns:
the field, or null if not found

getDeclaredFields

public static final List<FieldMetadata> getDeclaredFields(MemberHoldingTypeDetails memberHoldingTypeDetails)
Returns all declared fields

Parameters:
memberHoldingTypeDetails - the MemberHoldingTypeDetails to search (required)
Returns:
a List of declared fields, never null

getDeclaredMethod

public static final MethodMetadata getDeclaredMethod(MemberHoldingTypeDetails memberHoldingTypeDetails,
                                                     org.springframework.roo.model.JavaSymbolName methodName,
                                                     List<org.springframework.roo.model.JavaType> parameters)
Locates the specified method.

Parameters:
memberHoldingTypeDetails - the MemberHoldingTypeDetails to search (required)
methodName - to locate (required)
parameters - to locate (can be null if there are no parameters)
Returns:
the method, or null if not found

getDeclaredConstructor

public static final ConstructorMetadata getDeclaredConstructor(MemberHoldingTypeDetails memberHoldingTypeDetails,
                                                               List<org.springframework.roo.model.JavaType> parameters)
Locates the specified constructor.

Parameters:
memberHoldingTypeDetails - the MemberHoldingTypeDetails to search (required)
parameters - to locate (can be null if there are no parameters)
Returns:
the constructor, or null if not found

getDeclaredTypeAnnotation

public static final AnnotationMetadata getDeclaredTypeAnnotation(MemberHoldingTypeDetails memberHoldingTypeDetails,
                                                                 org.springframework.roo.model.JavaType type)
Locates the specified type-level annotation.

Parameters:
memberHoldingTypeDetails - the MemberHoldingTypeDetails to search (required)
type - to locate (required)
Returns:
the annotation, or null if not found

getAnnotationOfType

public static final AnnotationMetadata getAnnotationOfType(List<? extends AnnotationMetadata> annotations,
                                                           org.springframework.roo.model.JavaType type)
Locates an annotation with the specified type from a list of annotations.

Parameters:
annotations - to search (required)
type - to locate (required)
Returns:
the annotation, or null if not found

getTypeAnnotation

public static final AnnotationMetadata getTypeAnnotation(ClassOrInterfaceTypeDetails classOrInterfaceTypeDetails,
                                                         org.springframework.roo.model.JavaType annotationType)
Locates an annotation on this class and its superclasses.

Parameters:
classOrInterfaceTypeDetails - to search (required)
annotationType - annotation to locate (required)
Returns:
the annotation, if ever found (or null if not found)

getMethods

public static final List<MethodMetadata> getMethods(ClassOrInterfaceTypeDetails classOrInterfaceTypeDetails)
Locates all methods on this class and its superclasses.

Parameters:
classOrInterfaceTypeDetails - to search (required)
Returns:
zero or more methods (never null)

getField

public static final FieldMetadata getField(ClassOrInterfaceTypeDetails classOrInterfaceTypeDetails,
                                           org.springframework.roo.model.JavaSymbolName fieldName)
Searches up the inheritance hierarchy until the first field with the specified name is located.

Parameters:
classOrInterfaceTypeDetails - to search (required)
fieldName - to locate (required)
Returns:
the field, or null if not found

getFieldsWithAnnotation

public static final List<FieldMetadata> getFieldsWithAnnotation(ClassOrInterfaceTypeDetails classOrInterfaceTypeDetails,
                                                                org.springframework.roo.model.JavaType annotation)
Searches up the inheritance hierarchy and locates all declared fields which are annotated with the specified annotation.

Parameters:
classOrInterfaceTypeDetails - to search (required)
annotation - to locate (required)
Returns:
all the located fields (never null, but may be empty)

getMethod

public static final MethodMetadata getMethod(ClassOrInterfaceTypeDetails classOrInterfaceTypeDetails,
                                             org.springframework.roo.model.JavaSymbolName methodName,
                                             List<org.springframework.roo.model.JavaType> parameters)
Searches up the inheritance hierarchy until the first method with the specified name and parameters is located.

Parameters:
classOrInterfaceTypeDetails - to search (required)
methodName - to locate (required)
parameters - to locate (can be null if there are no parameters)
Returns:
the method, or null if not found


Copyright © 2009-2010 VMware, Inc. All Rights Reserved.