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>, 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
 
Nested classes/interfaces inherited from class org.jboss.webbeans.introspector.jlr.AbstractAnnotatedItem
AbstractAnnotatedItem.AnnotationMap
 
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
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<java.lang.Object>> 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<java.lang.Object>> 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 delegate)
 T invoke(java.lang.Object instance, Manager manager)
          Invokes the method on an instance with current parameters from manager
 T invoke(java.lang.Object instance, java.lang.Object... parameters)
          Invokes the method on an instance with given parameters
 T invokeOnInstance(java.lang.Object instance, Manager manager)
          Invokes the method on the class of the passed instance, not the declaring class.
 T invokeWithSpecialValue(java.lang.Object instance, java.lang.Class<? extends java.lang.annotation.Annotation> specialParam, java.lang.Object specialVal, Manager manager)
          Invokes the observer method
 java.lang.String toDetailedString()
           
 java.lang.String toString()
          Gets a string representation of the method
 
Methods inherited from class org.jboss.webbeans.introspector.jlr.AbstractAnnotatedMember
getName, getValue, isFinal, isStatic
 
Methods inherited from class org.jboss.webbeans.introspector.jlr.AbstractAnnotatedItem
buildAnnotationMap, buildAnnotationMap, getAnnotation, getAnnotationMap, getAnnotations, getBindingTypes, getBindingTypesAsArray, getMetaAnnotations, getMetaAnnotationsAsArray, getParameterValues, getParameterValues, isAnnotationPresent, isAssignableFrom, isAssignableFrom, isProxyable
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.webbeans.introspector.AnnotatedItem
getAnnotation, getAnnotations, getBindingTypes, getBindingTypesAsArray, getMetaAnnotations, getMetaAnnotationsAsArray, getName, isAnnotationPresent, isAssignableFrom, isAssignableFrom, isFinal, isProxyable, isStatic
 

Constructor Detail

AnnotatedMethodImpl

public 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

getAnnotatedMethod

public java.lang.reflect.Method getAnnotatedMethod()
Gets the annotated method

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<java.lang.Object>> 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<java.lang.Object>> 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

hashCode

public int hashCode()
Gets the hash code (of the delegate)

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

invoke

public T invoke(java.lang.Object instance,
                Manager manager)
Invokes the method on an instance with current parameters from manager

Specified by:
invoke in interface AnnotatedMethod<T>
Parameters:
instance - The instance to invoke on
manager - The Web Beans manager
Returns:
The return value of the invocation
See Also:
org.jboss.webbeans.introspector.AnnotatedMethod#invoke(ManagerImpl, Object)

invokeOnInstance

public T invokeOnInstance(java.lang.Object instance,
                          Manager manager)
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
manager - The Web Beans manager
Returns:
A reference to the instance

invokeWithSpecialValue

public T invokeWithSpecialValue(java.lang.Object instance,
                                java.lang.Class<? extends java.lang.annotation.Annotation> specialParam,
                                java.lang.Object specialVal,
                                Manager manager)
Description copied from interface: AnnotatedMethod
Invokes the observer method

Specified by:
invokeWithSpecialValue in interface AnnotatedMethod<T>
Parameters:
instance - The instance to invoke
manager - The Web Beans manager
Returns:
A reference to the instance

invoke

public T invoke(java.lang.Object instance,
                java.lang.Object... parameters)
Invokes the method on an instance with given parameters

Specified by:
invoke in interface AnnotatedMethod<T>
Parameters:
instance - The instance to invoke on
parameters - The parameters
Returns:
A reference to the instance
See Also:
AnnotatedMethod.invoke(Object, Object...)

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

toDetailedString

public java.lang.String toDetailedString()
Overrides:
toDetailedString in class AbstractAnnotatedMember<T,java.lang.reflect.Method>


Copyright © 2008. All Rights Reserved.