Top Inners Fields Constructors Methods
org.codehaus.groovy.reflection

public Class CachedMethod

extends MetaMethod
implements Comparable
Class Inheritance
All Implemented Interfaces
java.lang.Comparable
Imports
groovy.lang.MetaClassImpl, .MetaMethod, .MissingMethodException, org.codehaus.groovy.classgen.asm.BytecodeHelper, org.codehaus.groovy.runtime.InvokerInvocationException, org.codehaus.groovy.runtime.callsite.CallSite, .CallSiteGenerator, .PogoMetaMethodSite, .PojoMetaMethodSite, .StaticMetaMethodSite, org.codehaus.groovy.runtime.metaclass.MethodHelper, java.io.Serializable, java.lang.annotation.Annotation, java.lang.ref.SoftReference, java.lang.reflect.Constructor, .InvocationTargetException, .Method, java.util.Arrays, .Comparator

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
public final CachedClass
private final Method
private static final CachedMethod.MyComparator
public static final CachedMethod[]
private int
private boolean
private SoftReference<Constructor<T>>
private SoftReference<Constructor<T>>
private boolean
private SoftReference<Constructor<T>>
private CachedMethod

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public boolean
canAccessLegally(Class<?> callerClass)

public int
compareTo(Object
the object to be compared.
o
)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.
private int
private int
public CallSite
createPogoMetaMethodSite(CallSite site, MetaClassImpl metaClass, Class<T>[] params)

public CallSite
createPojoMetaMethodSite(CallSite site, MetaClassImpl metaClass, Class<T>[] params)

public CallSite
public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public static CachedMethod
find(Method method)

public <T extends Annotation> T
getAnnotation(Class<T> annotationClass)

public Method
private static Constructor<T>
public CachedClass
getDeclaringClass()

Implements abstract groovy.lang.MetaMethod.getDeclaringClass.

Gets the class where this method is declared
public String
getDescriptor()

Overrides groovy.lang.MetaMethod.getDescriptor.

Return a descriptor of this method based on the return type and parameters of this method.
public int
getModifiers()

Implements abstract groovy.lang.MetaMethod.getModifiers.

Returns the modifiers for this method
public String
getName()

Implements abstract groovy.lang.MetaMethod.getName.

Returns the name of the method represented by this class
public int
public ParameterTypes
public Class<T>[]
public Class<T>
getReturnType()

Implements abstract groovy.lang.MetaMethod.getReturnType.

Access the return type for this method
public String
getSignature()

Overrides groovy.lang.MetaMethod.getSignature.

Returns the signature of this method
public CachedMethod
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public final Object
invoke(Object
The object this method should be invoked on
object
,
Object[]
The arguments for the method if applicable
arguments
)

Implements abstract groovy.lang.MetaMethod.invoke.

Invoke this method
public boolean
isStatic()

Overrides groovy.lang.MetaMethod.isStatic.

Returns whether or not this method is static.
public boolean
private void
public final Method
public void
public String
toString()

Overrides groovy.lang.MetaMethod.toString.

Returns a string representation of this method
Inherited from groovy.lang.MetaMethod:
checkParametersclonedoMethodInvokeequalequalgetMopNameisAbstractisCacheableisMethodisPrivateisProtectedisPublicisSameprocessDoMethodInvokeException

Field Detail

cachedClassback to summary
public final CachedClass cachedClass
cachedMethodback to summary
private final Method cachedMethod
COMPARATORback to summary
private static final CachedMethod.MyComparator COMPARATOR
EMPTY_ARRAYback to summary
public static final CachedMethod[] EMPTY_ARRAY

Hides groovy.lang.MetaMethod.EMPTY_ARRAY.

hashCodeback to summary
private int hashCode
makeAccessibleDoneback to summary
private boolean makeAccessibleDone
pogoCallSiteConstructorback to summary
private SoftReference<Constructor<T>> pogoCallSiteConstructor
pojoCallSiteConstructorback to summary
private SoftReference<Constructor<T>> pojoCallSiteConstructor
skipCompiledback to summary
private boolean skipCompiled
staticCallSiteConstructorback to summary
private SoftReference<Constructor<T>> staticCallSiteConstructor
transformedMethodback to summary
private CachedMethod transformedMethod

Constructor Detail

CachedMethodback to summary
public CachedMethod(CachedClass clazz, Method method)
CachedMethodback to summary
public CachedMethod(Method method)

Method Detail

canAccessLegallyback to summary
public boolean canAccessLegally(Class<?> callerClass)
compareToback to summary
public int compareTo(Object o)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Parameters
o:Object

the object to be compared.

Returns:int

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

compareToCachedMethodback to summary
private int compareToCachedMethod(CachedMethod other)
compareToMethodback to summary
private int compareToMethod(Method other)
createPogoMetaMethodSiteback to summary
public CallSite createPogoMetaMethodSite(CallSite site, MetaClassImpl metaClass, Class<T>[] params)
createPojoMetaMethodSiteback to summary
public CallSite createPojoMetaMethodSite(CallSite site, MetaClassImpl metaClass, Class<T>[] params)
createStaticMetaMethodSiteback to summary
public CallSite createStaticMetaMethodSite(CallSite site, MetaClassImpl metaClass, Class<T>[] params)
equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

findback to summary
public static CachedMethod find(Method method)
getAnnotationback to summary
public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
getCachedMethodback to summary
public Method getCachedMethod()
getConstructorback to summary
private static Constructor<T> getConstructor(SoftReference<Constructor<T>> ref)
getDeclaringClassback to summary
public CachedClass getDeclaringClass()

Implements abstract groovy.lang.MetaMethod.getDeclaringClass.

Doc from groovy.lang.MetaMethod.getDeclaringClass.

Gets the class where this method is declared

Returns:CachedClass

class of this method

getDescriptorback to summary
public String getDescriptor()

Overrides groovy.lang.MetaMethod.getDescriptor.

Doc from groovy.lang.MetaMethod.getDescriptor.

Return a descriptor of this method based on the return type and parameters of this method.

getModifiersback to summary
public int getModifiers()

Implements abstract groovy.lang.MetaMethod.getModifiers.

Doc from groovy.lang.MetaMethod.getModifiers.

Returns the modifiers for this method

Returns:int

modifiers as an int.

getNameback to summary
public String getName()

Implements abstract groovy.lang.MetaMethod.getName.

Doc from groovy.lang.MetaMethod.getName.

Returns the name of the method represented by this class

Returns:String

name of this method

getParamsCountback to summary
public int getParamsCount()
getParamTypesback to summary
public ParameterTypes getParamTypes()
getPTback to summary
public Class<T>[] getPT()

Overrides org.codehaus.groovy.reflection.ParameterTypes.getPT.

getReturnTypeback to summary
public Class<T> getReturnType()

Implements abstract groovy.lang.MetaMethod.getReturnType.

Doc from groovy.lang.MetaMethod.getReturnType.

Access the return type for this method

Returns:Class<T>

the return type of this method

getSignatureback to summary
public String getSignature()

Overrides groovy.lang.MetaMethod.getSignature.

Doc from groovy.lang.MetaMethod.getSignature.

Returns the signature of this method

Returns:String

The signature of this method

getTransformedMethodback to summary
public CachedMethod getTransformedMethod()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

invokeback to summary
public final Object invoke(Object object, Object[] arguments)

Implements abstract groovy.lang.MetaMethod.invoke.

Doc from groovy.lang.MetaMethod.invoke.

Invoke this method

Parameters
object:Object

The object this method should be invoked on

arguments:Object[]

The arguments for the method if applicable

Returns:Object

The return value of the invocation

isStaticback to summary
public boolean isStatic()

Overrides groovy.lang.MetaMethod.isStatic.

Doc from groovy.lang.MetaMethod.isStatic.

Returns whether or not this method is static.

Returns:boolean

true if this method is static

isSyntheticback to summary
public boolean isSynthetic()
makeAccessibleIfNecessaryback to summary
private void makeAccessibleIfNecessary()
setAccessibleback to summary
public final Method setAccessible()
setTransformedMethodback to summary
public void setTransformedMethod(CachedMethod transformedMethod)
toStringback to summary
public String toString()

Overrides groovy.lang.MetaMethod.toString.

Doc from groovy.lang.MetaMethod.toString.

Returns a string representation of this method

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object.

org.codehaus.groovy.reflection back to summary

private Class CachedMethod.MyComparator

extends Object
implements Comparator, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, java.util.Comparator

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public int
compare(Object
the first object to be compared.
o1
,
Object
the second object to be compared.
o2
)

Implements java.util.Comparator.compare.

Compares its two arguments for order.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

MyComparatorback to summary
private MyComparator()

Method Detail

compareback to summary
public int compare(Object o1, Object o2)

Implements java.util.Comparator.compare.

Doc from java.util.Comparator.compare.

Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

The implementor must ensure that signum(compare(x, y)) == -signum(compare(y, x)) for all x and y. (This implies that compare(x, y) must throw an exception if and only if compare(y, x) throws an exception.)

The implementor must also ensure that the relation is transitive: ((compare(x, y)>0) && (compare(y, z)>0)) implies compare(x, z)>0.

Finally, the implementor must ensure that compare(x, y)==0 implies that signum(compare(x, z))==signum(compare(y, z)) for all z.

Parameters
o1:Object

the first object to be compared.

o2:Object

the second object to be compared.

Returns:int

a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.