com.google.gwt.inject.rebind.reflect
Class MethodLiteral<T,M extends java.lang.reflect.Member & java.lang.reflect.AnnotatedElement & java.lang.reflect.GenericDeclaration>

java.lang.Object
  extended by com.google.gwt.inject.rebind.reflect.MemberLiteral<T,M>
      extended by com.google.gwt.inject.rebind.reflect.MethodLiteral<T,M>

public abstract class MethodLiteral<T,M extends java.lang.reflect.Member & java.lang.reflect.AnnotatedElement & java.lang.reflect.GenericDeclaration>
extends MemberLiteral<T,M>

Generic method and constructor representation that preserves the member's parametrization and allows common operations on methods and constructors where appropriate.

See Also:
TypeLiteral

Constructor Summary
protected MethodLiteral(M member, TypeLiteral<T> declaringType)
           
 
Method Summary
static
<T> MethodLiteral<T,java.lang.reflect.Constructor<?>>
get(java.lang.reflect.Constructor<?> constructor, TypeLiteral<T> declaringType)
          Creates a new MethodLiteral based on the passed constructor and its declaring type.
static
<T> MethodLiteral<T,java.lang.reflect.Method>
get(java.lang.reflect.Method method, TypeLiteral<T> declaringType)
          Creates a new MethodLiteral based on the passed method and its declaring type.
 java.util.List<TypeLiteral<?>> getExceptionTypes()
          Returns this method's exception types, if appropriate parametrized with the declaring class's type parameters.
protected abstract  java.lang.annotation.Annotation[][] getParameterAnnotations()
           
 java.util.List<Key<?>> getParameterKeys()
          Returns this method's parameter keys, if appropriate parametrized with the declaring class's type parameters.
 java.util.List<TypeLiteral<?>> getParameterTypes()
          Returns this method's parameter types, if appropriate parametrized with the declaring class's type parameters.
abstract  java.util.List<java.lang.reflect.Type> getRawParameterTypes()
          Returns this method's parameter types without any type parametrization applied.
abstract  TypeLiteral<?> getReturnType()
          Returns this method's return type, if appropriate parametrized with the declaring class's type parameters.
 java.lang.reflect.TypeVariable<?>[] getTypeParameters()
          Returns this method's type parameters.
abstract  boolean isConstructor()
          Returns true if this method literal is based on a constructor.
 java.lang.String toString()
          Returns the method's declaring type and name in the format used in javadoc, e.g.
 
Methods inherited from class com.google.gwt.inject.rebind.reflect.MemberLiteral
getAnnotation, getAnnotations, getBindingAnnotation, getBindingAnnotation, getDeclaringType, getMember, getModifiers, getName, getRawDeclaringType, isAnnotationPresent, isDefaultAccess, isPrivate, isPublic, isStatic
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MethodLiteral

protected MethodLiteral(M member,
                        TypeLiteral<T> declaringType)
Method Detail

get

public static <T> MethodLiteral<T,java.lang.reflect.Method> get(java.lang.reflect.Method method,
                                                                TypeLiteral<T> declaringType)
Creates a new MethodLiteral based on the passed method and its declaring type.

Parameters:
method - method for which the literal is constructed
declaringType - type declaring the passed method
Returns:
new method literal

get

public static <T> MethodLiteral<T,java.lang.reflect.Constructor<?>> get(java.lang.reflect.Constructor<?> constructor,
                                                                        TypeLiteral<T> declaringType)
Creates a new MethodLiteral based on the passed constructor and its declaring type.

Parameters:
constructor - constructor for which the literal is constructed
declaringType - type declaring the constructor
Returns:
new method literal

getParameterKeys

public java.util.List<Key<?>> getParameterKeys()
Returns this method's parameter keys, if appropriate parametrized with the declaring class's type parameters.

Returns:
parameter keys

getParameterTypes

public java.util.List<TypeLiteral<?>> getParameterTypes()
Returns this method's parameter types, if appropriate parametrized with the declaring class's type parameters.

Returns:
parameter types

getRawParameterTypes

public abstract java.util.List<java.lang.reflect.Type> getRawParameterTypes()
Returns this method's parameter types without any type parametrization applied. For example, &lt;T> void foo(T t) will return a list with a single entry, a TypeVariable with name T and bounded by java.lang.Object.

Returns:
raw parameter types

getExceptionTypes

public java.util.List<TypeLiteral<?>> getExceptionTypes()
Returns this method's exception types, if appropriate parametrized with the declaring class's type parameters.

Returns:
exception types

getTypeParameters

public java.lang.reflect.TypeVariable<?>[] getTypeParameters()
Returns this method's type parameters.

Returns:
type parameters

getReturnType

public abstract TypeLiteral<?> getReturnType()
Returns this method's return type, if appropriate parametrized with the declaring class's type parameters.

Returns:
return type

isConstructor

public abstract boolean isConstructor()
Returns true if this method literal is based on a constructor.


getParameterAnnotations

protected abstract java.lang.annotation.Annotation[][] getParameterAnnotations()

toString

public java.lang.String toString()
Returns the method's declaring type and name in the format used in javadoc, e.g. com.bar.Foo#baz(com.bar.Foo, com.bar.Bar), with resolved type parameters.

Overrides:
toString in class java.lang.Object
Returns:
string representation for this method including the declaring type