org.jboss.webbeans.introspector.jlr
Class AnnotatedMethodImpl<T>

java.lang.Object
  extended by org.jboss.webbeans.introspector.jlr.AbstractAnnotatedItem<T,S>
      extended by org.jboss.webbeans.introspector.jlr.AbstractAnnotatedMember<T,java.lang.reflect.Method>
          extended by org.jboss.webbeans.introspector.jlr.AnnotatedMethodImpl<T>
Type Parameters:
T -
All Implemented Interfaces:
AnnotatedItem<T,java.lang.reflect.Method>, AnnotatedMember<T,java.lang.reflect.Method>, AnnotatedMethod<T>

public class AnnotatedMethodImpl<T>
extends AbstractAnnotatedMember<T,java.lang.reflect.Method>
implements AnnotatedMethod<T>

Represents an annotated method This class is immutable and therefore threadsafe

Author:
Pete Muir

Field Summary
 
Fields inherited from interface org.jboss.webbeans.introspector.AnnotatedMethod
MAPPED_PARAMETER_ANNOTATIONS
 
Fields inherited from interface org.jboss.webbeans.introspector.AnnotatedItem
MAPPED_METAANNOTATIONS
 
Constructor Summary
protected AnnotatedMethodImpl(java.lang.reflect.Method method, AnnotatedType<?> declaringClass)
          Constructor Initializes the superclass with the built annotation map, sets the method and declaring class abstraction and detects the actual type arguments
 
Method Summary
 boolean equals(java.lang.Object other)
          Compares two AbstractAnnotatedItems
 java.lang.reflect.Method getAnnotatedMethod()
           
 java.util.List<AnnotatedParameter<?>> getAnnotatedParameters(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
          Gets the list of annotated parameters for a given annotation
 AnnotatedType<?> getDeclaringClass()
          Gets the declaring class
 java.lang.reflect.Method getDelegate()
           
 java.util.List<AnnotatedParameter<?>> getParameters()
          Gets the abstracted parameters of the method
 java.lang.Class<?>[] getParameterTypesAsArray()
          Get the parameter types as an array
 java.lang.String getPropertyName()
          Gets the property name
 MethodSignature getSignature()
           
 int hashCode()
          Gets the hash code of the actual type
 T invoke(java.lang.Object instance, java.lang.Object... parameters)
          Invokes the method
 T invokeOnInstance(java.lang.Object instance, java.lang.Object... parameters)
          Invokes the method on the class of the passed instance, not the declaring class.
 boolean isEquivalent(java.lang.reflect.Method method)
          Checks if a this is equivalent to a JLR method
static
<T> AnnotatedMethodImpl<T>
of(java.lang.reflect.Method method, AnnotatedType<?> declaringClass)
           
 java.lang.String toString()
          Gets a string representation of the member
 
Methods inherited from class org.jboss.webbeans.introspector.jlr.AbstractAnnotatedMember
getMember, getName, getValue, isFinal, isPublic, isStatic, isTransient
 
Methods inherited from class org.jboss.webbeans.introspector.jlr.AbstractAnnotatedItem
getActualTypeArguments, getAnnotation, getAnnotationsAsSet, getAnnotationStore, getBindings, getBindingsAsArray, getDeclaredMetaAnnotations, getFlattenedTypeHierarchy, getMetaAnnotations, getMetaAnnotationsAsArray, getRawType, getType, isAnnotationPresent, isAssignableFrom, isAssignableFrom, isDeclaredAnnotationPresent, isParameterizedType, isProxyable
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.webbeans.introspector.AnnotatedMember
getMember
 
Methods inherited from interface org.jboss.webbeans.introspector.AnnotatedItem
getActualTypeArguments, getAnnotation, getAnnotationsAsSet, getAnnotationStore, getBindings, getBindingsAsArray, getDeclaredMetaAnnotations, getFlattenedTypeHierarchy, getMetaAnnotations, getMetaAnnotationsAsArray, getName, getRawType, getType, isAnnotationPresent, isAssignableFrom, isAssignableFrom, isDeclaredAnnotationPresent, isFinal, isParameterizedType, isProxyable, isPublic, isStatic
 

Constructor Detail

AnnotatedMethodImpl

protected AnnotatedMethodImpl(java.lang.reflect.Method method,
                              AnnotatedType<?> declaringClass)
Constructor Initializes the superclass with the built annotation map, sets the method and declaring class abstraction and detects the actual type arguments

Parameters:
method - The underlying method
declaringClass - The declaring class abstraction
Method Detail

of

public static <T> AnnotatedMethodImpl<T> of(java.lang.reflect.Method method,
                                            AnnotatedType<?> declaringClass)

getAnnotatedMethod

public java.lang.reflect.Method getAnnotatedMethod()
Specified by:
getAnnotatedMethod in interface AnnotatedMethod<T>

getDelegate

public java.lang.reflect.Method getDelegate()
Specified by:
getDelegate in class AbstractAnnotatedItem<T,java.lang.reflect.Method>

getParameters

public java.util.List<AnnotatedParameter<?>> getParameters()
Description copied from interface: AnnotatedMethod
Gets the abstracted parameters of the method

Specified by:
getParameters in interface AnnotatedMethod<T>
Returns:
A list of parameters. Returns an empty list if no parameters are present.

getParameterTypesAsArray

public java.lang.Class<?>[] getParameterTypesAsArray()
Description copied from interface: AnnotatedMethod
Get the parameter types as an array

Specified by:
getParameterTypesAsArray in interface AnnotatedMethod<T>

getAnnotatedParameters

public java.util.List<AnnotatedParameter<?>> getAnnotatedParameters(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Description copied from interface: AnnotatedMethod
Gets the list of annotated parameters for a given annotation

Specified by:
getAnnotatedParameters in interface AnnotatedMethod<T>
Parameters:
annotationType - The annotation to match
Returns:
A set of matching parameter abstractions. Returns an empty list if there are no matches.

equals

public boolean equals(java.lang.Object other)
Description copied from class: AbstractAnnotatedItem
Compares two AbstractAnnotatedItems

Overrides:
equals in class AbstractAnnotatedItem<T,java.lang.reflect.Method>
Parameters:
other - The other item
Returns:
True if equals, false otherwise

isEquivalent

public boolean isEquivalent(java.lang.reflect.Method method)
Description copied from interface: AnnotatedMethod
Checks if a this is equivalent to a JLR method

Specified by:
isEquivalent in interface AnnotatedMethod<T>
Parameters:
method - The JLR method
Returns:
true if equivalent

hashCode

public int hashCode()
Description copied from class: AbstractAnnotatedItem
Gets the hash code of the actual type

Overrides:
hashCode in class AbstractAnnotatedItem<T,java.lang.reflect.Method>
Returns:
The hash code

invokeOnInstance

public T invokeOnInstance(java.lang.Object instance,
                          java.lang.Object... parameters)
                   throws java.lang.IllegalArgumentException,
                          java.lang.SecurityException,
                          java.lang.IllegalAccessException,
                          java.lang.reflect.InvocationTargetException,
                          java.lang.NoSuchMethodException
Description copied from interface: AnnotatedMethod
Invokes the method on the class of the passed instance, not the declaring class. Useful with proxies

Specified by:
invokeOnInstance in interface AnnotatedMethod<T>
Parameters:
instance - The instance to invoke
Returns:
A reference to the instance
Throws:
java.lang.IllegalArgumentException
java.lang.SecurityException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodException

invoke

public T invoke(java.lang.Object instance,
                java.lang.Object... parameters)
         throws java.lang.IllegalArgumentException,
                java.lang.IllegalAccessException,
                java.lang.reflect.InvocationTargetException
Description copied from interface: AnnotatedMethod
Invokes the method

Specified by:
invoke in interface AnnotatedMethod<T>
Parameters:
instance - The instance to invoke
parameters - The method parameters
Returns:
A reference to the instance
Throws:
java.lang.IllegalArgumentException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException

getPropertyName

public java.lang.String getPropertyName()
Description copied from interface: AnnotatedMethod
Gets the property name

Specified by:
getPropertyName in interface AnnotatedMethod<T>
Returns:
The name

getDeclaringClass

public AnnotatedType<?> getDeclaringClass()
Description copied from interface: AnnotatedMethod
Gets the declaring class

Specified by:
getDeclaringClass in interface AnnotatedMember<T,java.lang.reflect.Method>
Specified by:
getDeclaringClass in interface AnnotatedMethod<T>
Returns:
An abstraction of the declaring class

toString

public java.lang.String toString()
Description copied from class: AbstractAnnotatedMember
Gets a string representation of the member

Overrides:
toString in class AbstractAnnotatedMember<T,java.lang.reflect.Method>
Returns:
A string representation

getSignature

public MethodSignature getSignature()
Specified by:
getSignature in interface AnnotatedMethod<T>


Copyright © 2011. All Rights Reserved.