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

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jboss.webbeans.introspector.jlr.AbstractAnnotatedMember
AbstractAnnotatedMember.AnnotatedParameterMap
 
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 annotated methods (delegates)
 java.lang.reflect.Type[] getActualTypeArguments()
          Gets the actual type arguments
 java.lang.reflect.Method getAnnotatedMethod()
          Gets the annotated method
 java.util.List<AnnotatedParameter<?>> getAnnotatedParameters(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
          Gets the parameter abstractions with a given annotation type If the parameter abstractions are null, they are initialized first
 AnnotatedType<?> getDeclaringClass()
          Gets the declaring class
 java.lang.reflect.Method getDelegate()
          Gets the delegate
 java.util.List<AnnotatedParameter<?>> getParameters()
          Gets the annotated parameters If the parameters are null, they are initialized first
 java.lang.Class<?>[] getParameterTypesAsArray()
          Get the parameter types as an array
 java.lang.String getPropertyName()
          Gets the name of the property
 java.lang.Class<T> getType()
          Gets the type of the method
 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 method
 
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
getAnnotation, getAnnotationsAsSet, getAnnotationStore, getBindingTypes, getBindingTypesAsArray, getDeclaredMetaAnnotations, getMetaAnnotations, getMetaAnnotationsAsArray, isAnnotationPresent, isAssignableFrom, isAssignableFrom, isDeclaredAnnotationPresent, 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
getAnnotation, getAnnotationsAsSet, getAnnotationStore, getBindingTypes, getBindingTypesAsArray, getDeclaredMetaAnnotations, getMetaAnnotations, getMetaAnnotationsAsArray, getName, isAnnotationPresent, isAssignableFrom, isAssignableFrom, isDeclaredAnnotationPresent, isFinal, 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()
Gets the annotated method

Specified by:
getAnnotatedMethod in interface AnnotatedMethod<T>
Returns:
The method

getDelegate

public java.lang.reflect.Method getDelegate()
Gets the delegate

Specified by:
getDelegate in class AbstractAnnotatedItem<T,java.lang.reflect.Method>
Returns:
The delegate

getType

public java.lang.Class<T> getType()
Gets the type of the method

Specified by:
getType in interface AnnotatedItem<T,java.lang.reflect.Method>
Returns:
The return type of the method

getActualTypeArguments

public java.lang.reflect.Type[] getActualTypeArguments()
Gets the actual type arguments

Specified by:
getActualTypeArguments in interface AnnotatedItem<T,java.lang.reflect.Method>
Returns:
The actual type arguments
See Also:
AnnotatedItem.getActualTypeArguments()

getParameters

public java.util.List<AnnotatedParameter<?>> getParameters()
Gets the annotated parameters If the parameters are null, they are initialized first

Specified by:
getParameters in interface AnnotatedMethod<T>
Returns:
The annotated parameters
See Also:
AnnotatedMethod.getParameters()

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)
Gets the parameter abstractions with a given annotation type If the parameter abstractions are null, they are initialized first

Specified by:
getAnnotatedParameters in interface AnnotatedMethod<T>
Parameters:
annotationType - The annotation type to match
Returns:
The list of abstracted parameters with given annotation type present. An empty list is returned if there are no matches

equals

public boolean equals(java.lang.Object other)
Compares two annotated methods (delegates)

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()
Gets the name of the property

Specified by:
getPropertyName in interface AnnotatedMethod<T>
Returns:
The name
See Also:
AnnotatedMethod.getPropertyName()

getDeclaringClass

public AnnotatedType<?> getDeclaringClass()
Gets the declaring class

Specified by:
getDeclaringClass in interface AnnotatedMethod<T>
Returns:
The declaring class
See Also:
AnnotatedMethod.getDeclaringClass()

toString

public java.lang.String toString()
Gets a string representation of the method

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


Copyright © 2008-2009. All Rights Reserved.