org.springframework.roo.classpath.details
Class MemberFindingUtils

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

public final class MemberFindingUtils
extends Object

Utility methods for finding members in MemberHoldingTypeDetails instances.

Since:
1.0
Author:
Ben Alex, Stefan Schmidt, Andrew Swan

Method Summary
static AnnotationMetadata getAnnotationOfType(List<? extends AnnotationMetadata> annotations, org.springframework.roo.model.JavaType annotationType)
          Locates the metadata for an annotation of the specified type from within the given list.
static AnnotationMetadata getAnnotationOfType(MemberHoldingTypeDetailsMetadataItem<?> metadata, org.springframework.roo.model.JavaType annotationType)
          Returns the metadata for the annotation of the given type from within the given metadata
static List<ConstructorMetadata> getConstructors(MemberDetails memberDetails)
          Deprecated. use MemberDetails.getConstructors() instead
static ConstructorMetadata getDeclaredConstructor(MemberHoldingTypeDetails memberHoldingTypeDetails, List<org.springframework.roo.model.JavaType> parameters)
          Deprecated. use MemberHoldingTypeDetails.getDeclaredConstructor(List) instead
static FieldMetadata getDeclaredField(MemberHoldingTypeDetails memberHoldingTypeDetails, org.springframework.roo.model.JavaSymbolName fieldName)
          Deprecated. call MemberHoldingTypeDetails.getDeclaredField(JavaSymbolName) instead
static ClassOrInterfaceTypeDetails getDeclaredInnerType(MemberHoldingTypeDetails memberHoldingTypeDetails, org.springframework.roo.model.JavaType typeName)
          Deprecated. use MemberHoldingTypeDetails.getDeclaredInnerType(JavaType) instead
static MethodMetadata getDeclaredMethod(MemberHoldingTypeDetails memberHoldingTypeDetails, org.springframework.roo.model.JavaSymbolName methodName)
          Locates a method on the specified MemberHoldingTypeDetails based on the method name.
static MethodMetadata getDeclaredMethod(MemberHoldingTypeDetails memberHoldingTypeDetails, org.springframework.roo.model.JavaSymbolName methodName, List<org.springframework.roo.model.JavaType> parameters)
          Locates the specified method.
static AnnotationMetadataBuilder getDeclaredTypeAnnotation(AbstractIdentifiableAnnotatedJavaStructureBuilder<? extends IdentifiableAnnotatedJavaStructure> builder, org.springframework.roo.model.JavaType type)
          Deprecated. use AbstractIdentifiableAnnotatedJavaStructureBuilder.getDeclaredTypeAnnotation(JavaType) instead
static AnnotationMetadata getDeclaredTypeAnnotation(IdentifiableAnnotatedJavaStructure memberHoldingTypeDetails, org.springframework.roo.model.JavaType type)
          Deprecated. use IdentifiableAnnotatedJavaStructure.getAnnotation(JavaType) instead
static AnnotationMetadata getDeclaredTypeAnnotation(MemberDetails memberDetails, org.springframework.roo.model.JavaType type)
          Deprecated. use MemberDetails.getAnnotation(JavaType) instead
static FieldMetadata getField(MemberHoldingTypeDetails memberHoldingTypeDetails, org.springframework.roo.model.JavaSymbolName fieldName)
          Deprecated. use MemberHoldingTypeDetails.getField(JavaSymbolName) instead
static List<FieldMetadata> getFields(MemberDetails memberDetails)
          Deprecated. use MemberDetails.getFields() instead
static List<FieldMetadata> getFieldsWithAnnotation(MemberHoldingTypeDetails memberHoldingTypeDetails, org.springframework.roo.model.JavaType annotation)
          Deprecated. use MemberHoldingTypeDetails.getFieldsWithAnnotation(JavaType) instead
static List<FieldMetadata> getFieldsWithTag(MemberDetails memberDetails, Object tagKey)
          Returns all fields within the given MemberDetails that contain the given CustomData tag.
static AnnotationMetadata getFirstAnnotation(ClassOrInterfaceTypeDetails cid, org.springframework.roo.model.JavaType... annotationTypes)
          Returns the first of the given types of annotation on the given class or interface
static List<MemberHoldingTypeDetails> getMemberHoldingTypeDetailsWithTag(MemberDetails memberDetails, Object tagKey)
          Searches all MemberDetails and returns all MemberHoldingTypeDetails which contains a given CustomData tag.
static MethodMetadata getMethod(MemberDetails memberDetails, org.springframework.roo.model.JavaSymbolName methodName)
          Deprecated. use MemberDetails.getMethod(JavaSymbolName) instead
static MethodMetadata getMethod(MemberDetails memberDetails, org.springframework.roo.model.JavaSymbolName methodName, List<org.springframework.roo.model.JavaType> parameters)
          Deprecated. use MemberDetails.getMethod(JavaSymbolName, List) instead
static MethodMetadata getMethod(MemberDetails memberDetails, org.springframework.roo.model.JavaSymbolName methodName, List<org.springframework.roo.model.JavaType> parameters, String excludingMid)
          Deprecated. use MemberDetails.getMethod(JavaSymbolName, List, String) instead
static MethodMetadata getMethod(MemberDetails memberDetails, String methodName)
          Convenience method which converts a String method name to a JavaSymbolName for use by the standard getMethod(MemberDetails, org.springframework.roo.model.JavaSymbolName) .
static MethodMetadata getMethod(MemberHoldingTypeDetails memberHoldingTypeDetails, org.springframework.roo.model.JavaSymbolName methodName)
          Deprecated. use MemberHoldingTypeDetails.getMethod(JavaSymbolName) instead
static MethodMetadata getMethod(MemberHoldingTypeDetails memberHoldingTypeDetails, org.springframework.roo.model.JavaSymbolName methodName, List<org.springframework.roo.model.JavaType> parameters)
          Deprecated. use MemberHoldingTypeDetails.getMethod(JavaSymbolName, List) instead
static MethodMetadata getMethod(MemberHoldingTypeDetails memberHoldingTypeDetails, String methodName)
          Convenience method which converts a String method name to a JavaSymbolName for use by the standard getMethod(MemberHoldingTypeDetails, org.springframework.roo.model.JavaSymbolName) .
static List<MethodMetadata> getMethods(MemberDetails memberDetails)
          Deprecated. use MemberDetails.getMethods() instead
static List<MethodMetadata> getMethods(MemberHoldingTypeDetails memberHoldingTypeDetails)
          Deprecated. use MemberHoldingTypeDetails.getMethods() instead
static List<MethodMetadata> getMethodsWithTag(MemberDetails memberDetails, Object tagKey)
          Deprecated. use MemberDetails.getMethodsWithTag(Object) instead
static MemberHoldingTypeDetails getMostConcreteMemberHoldingTypeDetailsWithTag(MemberDetails memberDetails, Object tag)
          Determines the most concrete MemberHoldingTypeDetails in cases where multiple matches are found for a given tag.
static MethodMetadata getMostConcreteMethodWithTag(MemberDetails memberDetails, Object tagKey)
          Determines the most concrete MemberHoldingTypeDetails in cases where multiple matches are found for a given tag.
static AnnotationMetadata getTypeAnnotation(IdentifiableAnnotatedJavaStructure memberHoldingTypeDetails, org.springframework.roo.model.JavaType annotationType)
          Deprecated. use IdentifiableAnnotatedJavaStructure.getTypeAnnotation(JavaType) instead
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAnnotationOfType

public static AnnotationMetadata getAnnotationOfType(List<? extends AnnotationMetadata> annotations,
                                                     org.springframework.roo.model.JavaType annotationType)
Locates the metadata for an annotation of the specified type from within the given list.

Parameters:
annotations - the set of annotations to search (may be null)
annotationType - the annotation to locate (may be null)
Returns:
the annotation, or null if not found

getAnnotationOfType

public static AnnotationMetadata getAnnotationOfType(MemberHoldingTypeDetailsMetadataItem<?> metadata,
                                                     org.springframework.roo.model.JavaType annotationType)
Returns the metadata for the annotation of the given type from within the given metadata

Parameters:
metadata - the metadata to search; can be null
annotationType - the type of annotation for which to return the metadata; can be null
Returns:
null if not found
Since:
1.2.0

getConstructors

@Deprecated
public static List<ConstructorMetadata> getConstructors(MemberDetails memberDetails)
Deprecated. use MemberDetails.getConstructors() instead

Searches all MemberDetails and returns all constructors.

Parameters:
memberDetails - the MemberDetails to search (required)
Returns:
zero or more constructors (never null)

getDeclaredConstructor

@Deprecated
public static ConstructorMetadata getDeclaredConstructor(MemberHoldingTypeDetails memberHoldingTypeDetails,
                                                                    List<org.springframework.roo.model.JavaType> parameters)
Deprecated. use MemberHoldingTypeDetails.getDeclaredConstructor(List) instead

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

getDeclaredField

@Deprecated
public static FieldMetadata getDeclaredField(MemberHoldingTypeDetails memberHoldingTypeDetails,
                                                        org.springframework.roo.model.JavaSymbolName fieldName)
Deprecated. call MemberHoldingTypeDetails.getDeclaredField(JavaSymbolName) instead

Locates the specified field of the given MemberHoldingTypeDetails .

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

getDeclaredInnerType

@Deprecated
public static ClassOrInterfaceTypeDetails getDeclaredInnerType(MemberHoldingTypeDetails memberHoldingTypeDetails,
                                                                          org.springframework.roo.model.JavaType typeName)
Deprecated. use MemberHoldingTypeDetails.getDeclaredInnerType(JavaType) instead

Locates an inner type with the specified name.

Parameters:
MemberDetails - to search (required)
typeName - to locate (required)

getDeclaredMethod

public static MethodMetadata getDeclaredMethod(MemberHoldingTypeDetails memberHoldingTypeDetails,
                                               org.springframework.roo.model.JavaSymbolName methodName)
Locates a method on the specified MemberHoldingTypeDetails based on the method name.

Parameters:
memberHoldingTypeDetails - the MemberHoldingTypeDetails to search; can be null
methodName - to locate; can be null
Returns:
the method, or null if the given name was null or it was simply not found

getDeclaredMethod

public static 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; can be null
methodName - to locate; can be null
parameters - to locate (can be null if there are no parameters)
Returns:
the method, or null if the given name was null or it was simply not found

getDeclaredTypeAnnotation

@Deprecated
public static AnnotationMetadataBuilder getDeclaredTypeAnnotation(AbstractIdentifiableAnnotatedJavaStructureBuilder<? extends IdentifiableAnnotatedJavaStructure> builder,
                                                                             org.springframework.roo.model.JavaType type)
Deprecated. use AbstractIdentifiableAnnotatedJavaStructureBuilder.getDeclaredTypeAnnotation(JavaType) instead

Locates the specified type-level annotation.

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

getDeclaredTypeAnnotation

@Deprecated
public static AnnotationMetadata getDeclaredTypeAnnotation(IdentifiableAnnotatedJavaStructure memberHoldingTypeDetails,
                                                                      org.springframework.roo.model.JavaType type)
Deprecated. use IdentifiableAnnotatedJavaStructure.getAnnotation(JavaType) instead

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

getDeclaredTypeAnnotation

@Deprecated
public static AnnotationMetadata getDeclaredTypeAnnotation(MemberDetails memberDetails,
                                                                      org.springframework.roo.model.JavaType type)
Deprecated. use MemberDetails.getAnnotation(JavaType) instead

Locates the specified type-level annotation.

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

getField

@Deprecated
public static FieldMetadata getField(MemberHoldingTypeDetails memberHoldingTypeDetails,
                                                org.springframework.roo.model.JavaSymbolName fieldName)
Deprecated. use MemberHoldingTypeDetails.getField(JavaSymbolName) instead

Searches up the inheritance hierarchy until the first field with the specified name is located.

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

getFields

@Deprecated
public static List<FieldMetadata> getFields(MemberDetails memberDetails)
Deprecated. use MemberDetails.getFields() instead

Searches all MemberDetails and returns all fields.

Parameters:
memberDetails - the MemberDetails to search (required)
Returns:
zero or more fields (never null)

getFieldsWithAnnotation

@Deprecated
public static List<FieldMetadata> getFieldsWithAnnotation(MemberHoldingTypeDetails memberHoldingTypeDetails,
                                                                     org.springframework.roo.model.JavaType annotation)
Deprecated. use MemberHoldingTypeDetails.getFieldsWithAnnotation(JavaType) instead

Searches up the inheritance hierarchy and locates all declared fields which are annotated with the specified annotation.

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

getFieldsWithTag

public static List<FieldMetadata> getFieldsWithTag(MemberDetails memberDetails,
                                                   Object tagKey)
Returns all fields within the given MemberDetails that contain the given CustomData tag.

Parameters:
memberDetails - the MemberDetails to search (can be null)
tagKey - the CustomData key to search for
Returns:
zero or more fields (never null)

getFirstAnnotation

public static AnnotationMetadata getFirstAnnotation(ClassOrInterfaceTypeDetails cid,
                                                    org.springframework.roo.model.JavaType... annotationTypes)
Returns the first of the given types of annotation on the given class or interface

Parameters:
cid - the class or interface to check (can be null)
annotationTypes - the types of annotation to look for, in order (can be null)
Returns:
null if the given type or array of annotations is null, or none were found

getMemberHoldingTypeDetailsWithTag

public static List<MemberHoldingTypeDetails> getMemberHoldingTypeDetailsWithTag(MemberDetails memberDetails,
                                                                                Object tagKey)
Searches all MemberDetails and returns all MemberHoldingTypeDetails which contains a given CustomData tag.

Parameters:
memberDetails - the MemberDetails to search (can be null)
tagKey - the CustomData key to search for (required)
Returns:
zero or more MemberHoldingTypeDetails (never null)

getMethod

@Deprecated
public static MethodMetadata getMethod(MemberDetails memberDetails,
                                                  org.springframework.roo.model.JavaSymbolName methodName)
Deprecated. use MemberDetails.getMethod(JavaSymbolName) instead

Locates a method with the name presented. Searches all MemberDetails until the first such method is located or none can be found.

Parameters:
memberDetails - the MemberDetails to search (required)
methodName - the method name to locate (can be null)
Returns:
the first located method, or null if the method name is null or such a method cannot be found

getMethod

@Deprecated
public static MethodMetadata getMethod(MemberDetails memberDetails,
                                                  org.springframework.roo.model.JavaSymbolName methodName,
                                                  List<org.springframework.roo.model.JavaType> parameters)
Deprecated. use MemberDetails.getMethod(JavaSymbolName, List) instead

Locates a method with the name and parameter signature presented. Searches all MemberDetails until the first such method is located or none can be found.

Parameters:
memberDetails - the MemberDetails to search (required)
methodName - the method name to locate (can be null)
parameters - the method parameter signature to locate (can be null if no parameters are required)
Returns:
the first located method, or null if the method name is null or such a method cannot be found

getMethod

@Deprecated
public static MethodMetadata getMethod(MemberDetails memberDetails,
                                                  org.springframework.roo.model.JavaSymbolName methodName,
                                                  List<org.springframework.roo.model.JavaType> parameters,
                                                  String excludingMid)
Deprecated. use MemberDetails.getMethod(JavaSymbolName, List, String) instead

Locates a method with the name and parameter signature presented that is not declared by the presented MID.

Parameters:
memberDetails - the MemberDetails to search (required)
methodName - the method name to locate (can be null)
parameters - the method parameter signature to locate (can be null if no parameters are required)
excludingMid - the MID that a found method cannot be declared by
Returns:
the first located method, or null if the method name is null or such a method cannot be found

getMethod

public static MethodMetadata getMethod(MemberDetails memberDetails,
                                       String methodName)
Convenience method which converts a String method name to a JavaSymbolName for use by the standard getMethod(MemberDetails, org.springframework.roo.model.JavaSymbolName) .

Parameters:
memberHoldingTypeDetails - to search (required)
methodName - to locate (required)
Returns:
the method, or null if not found

getMethod

@Deprecated
public static MethodMetadata getMethod(MemberHoldingTypeDetails memberHoldingTypeDetails,
                                                  org.springframework.roo.model.JavaSymbolName methodName)
Deprecated. use MemberHoldingTypeDetails.getMethod(JavaSymbolName) instead

Searches up the inheritance hierarchy until the first method with the specified name is located, method parameters are not taken into account.

Parameters:
memberHoldingTypeDetails - to search (required)
methodName - to locate (required)
Returns:
the method, or null if not found

getMethod

@Deprecated
public static MethodMetadata getMethod(MemberHoldingTypeDetails memberHoldingTypeDetails,
                                                  org.springframework.roo.model.JavaSymbolName methodName,
                                                  List<org.springframework.roo.model.JavaType> parameters)
Deprecated. use MemberHoldingTypeDetails.getMethod(JavaSymbolName, List) instead

Searches up the inheritance hierarchy until the first method with the specified name and parameters is located.

Parameters:
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

getMethod

public static MethodMetadata getMethod(MemberHoldingTypeDetails memberHoldingTypeDetails,
                                       String methodName)
Convenience method which converts a String method name to a JavaSymbolName for use by the standard getMethod(MemberHoldingTypeDetails, org.springframework.roo.model.JavaSymbolName) .

Parameters:
memberHoldingTypeDetails - to search (required)
methodName - to locate (required)
Returns:
the method, or null if not found

getMethods

@Deprecated
public static List<MethodMetadata> getMethods(MemberDetails memberDetails)
Deprecated. use MemberDetails.getMethods() instead

Searches all MemberDetails and returns all methods.

Parameters:
memberDetails - the MemberDetails to search (required)
Returns:
zero or more methods (never null)

getMethods

@Deprecated
public static List<MethodMetadata> getMethods(MemberHoldingTypeDetails memberHoldingTypeDetails)
Deprecated. use MemberHoldingTypeDetails.getMethods() instead

Locates all methods on this class and its superclasses.

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

getMethodsWithTag

@Deprecated
public static List<MethodMetadata> getMethodsWithTag(MemberDetails memberDetails,
                                                                Object tagKey)
Deprecated. use MemberDetails.getMethodsWithTag(Object) instead

Searches all MemberDetails and returns all methods which contain a given CustomData tag.

Parameters:
memberDetails - the MemberDetails to search (required)
tagKey - the CustomData key to search for
Returns:
zero or more methods (never null)

getMostConcreteMemberHoldingTypeDetailsWithTag

public static MemberHoldingTypeDetails getMostConcreteMemberHoldingTypeDetailsWithTag(MemberDetails memberDetails,
                                                                                      Object tag)
Determines the most concrete MemberHoldingTypeDetails in cases where multiple matches are found for a given tag.

Parameters:
memberDetails - the MemberDetails to search (can be null)
tag - the CustomData key to search for (required)
Returns:
the most concrete tagged type or null if not found

getMostConcreteMethodWithTag

public static MethodMetadata getMostConcreteMethodWithTag(MemberDetails memberDetails,
                                                          Object tagKey)
Determines the most concrete MemberHoldingTypeDetails in cases where multiple matches are found for a given tag.

Parameters:
memberDetails - the MemberDetails to search (can be null)
tagKey - the CustomData key to search for (required)
Returns:
the most concrete tagged method or null if not found

getTypeAnnotation

@Deprecated
public static AnnotationMetadata getTypeAnnotation(IdentifiableAnnotatedJavaStructure memberHoldingTypeDetails,
                                                              org.springframework.roo.model.JavaType annotationType)
Deprecated. use IdentifiableAnnotatedJavaStructure.getTypeAnnotation(JavaType) instead

Locates an annotation on this class and its superclasses.

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


Copyright © 2009–2015. All rights reserved.