org.springframework.core.type.classreading
Class MethodMetadataReadingVisitor

java.lang.Object
  extended by MethodAdapter
      extended by org.springframework.core.type.classreading.MethodMetadataReadingVisitor
All Implemented Interfaces:
MethodMetadata

final class MethodMetadataReadingVisitor
extends MethodAdapter
implements MethodMetadata

ASM method visitor which looks for the annotations defined on the method, exposing them through the MethodMetadata interface.

Since:
3.0
Author:
Juergen Hoeller, Mark Pollack, Costin Leau

Field Summary
private  int access
           
private  java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> attributeMap
           
private  java.lang.ClassLoader classLoader
           
private  java.lang.String declaringClassName
           
private  MultiValueMap<java.lang.String,MethodMetadata> methodMetadataMap
           
private  java.lang.String name
           
 
Constructor Summary
MethodMetadataReadingVisitor(java.lang.String name, int access, java.lang.String declaringClassName, java.lang.ClassLoader classLoader, MultiValueMap<java.lang.String,MethodMetadata> methodMetadataMap)
           
 
Method Summary
 java.util.Map<java.lang.String,java.lang.Object> getAnnotationAttributes(java.lang.String annotationType)
          Retrieve the attributes of the annotation of the given type, if any (i.e.
 java.lang.String getDeclaringClassName()
          Return the fully-qualified name of the class that declares this method.
 java.lang.String getMethodName()
          Return the name of the method.
 boolean isAnnotated(java.lang.String annotationType)
          Determine whether the underlying method has an annotation or meta-annotation of the given type defined.
 boolean isFinal()
          Return whether the underlying method is marked as 'final'.
 boolean isOverridable()
          Return whether the underlying method is overridable, i.e.
 boolean isStatic()
          Return whether the underlying method is declared as 'static'.
 AnnotationVisitor visitAnnotation(java.lang.String desc, boolean visible)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

private final java.lang.String name

access

private final int access

declaringClassName

private java.lang.String declaringClassName

classLoader

private final java.lang.ClassLoader classLoader

methodMetadataMap

private final MultiValueMap<java.lang.String,MethodMetadata> methodMetadataMap

attributeMap

private final java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> attributeMap
Constructor Detail

MethodMetadataReadingVisitor

public MethodMetadataReadingVisitor(java.lang.String name,
                                    int access,
                                    java.lang.String declaringClassName,
                                    java.lang.ClassLoader classLoader,
                                    MultiValueMap<java.lang.String,MethodMetadata> methodMetadataMap)
Method Detail

visitAnnotation

public AnnotationVisitor visitAnnotation(java.lang.String desc,
                                         boolean visible)

getMethodName

public java.lang.String getMethodName()
Description copied from interface: MethodMetadata
Return the name of the method.

Specified by:
getMethodName in interface MethodMetadata

isStatic

public boolean isStatic()
Description copied from interface: MethodMetadata
Return whether the underlying method is declared as 'static'.

Specified by:
isStatic in interface MethodMetadata

isFinal

public boolean isFinal()
Description copied from interface: MethodMetadata
Return whether the underlying method is marked as 'final'.

Specified by:
isFinal in interface MethodMetadata

isOverridable

public boolean isOverridable()
Description copied from interface: MethodMetadata
Return whether the underlying method is overridable, i.e. not marked as static, final or private.

Specified by:
isOverridable in interface MethodMetadata

isAnnotated

public boolean isAnnotated(java.lang.String annotationType)
Description copied from interface: MethodMetadata
Determine whether the underlying method has an annotation or meta-annotation of the given type defined.

Specified by:
isAnnotated in interface MethodMetadata
Parameters:
annotationType - the annotation type to look for
Returns:
whether a matching annotation is defined

getAnnotationAttributes

public java.util.Map<java.lang.String,java.lang.Object> getAnnotationAttributes(java.lang.String annotationType)
Description copied from interface: MethodMetadata
Retrieve the attributes of the annotation of the given type, if any (i.e. if defined on the underlying method, as direct annotation or as meta-annotation).

Specified by:
getAnnotationAttributes in interface MethodMetadata
Parameters:
annotationType - the annotation type to look for
Returns:
a Map of attributes, with the attribute name as key (e.g. "value") and the defined attribute value as Map value. This return value will be null if no matching annotation is defined.

getDeclaringClassName

public java.lang.String getDeclaringClassName()
Description copied from interface: MethodMetadata
Return the fully-qualified name of the class that declares this method.

Specified by:
getDeclaringClassName in interface MethodMetadata