org.codehaus.groovy.reflection
Class CachedClass

java.lang.Object
  extended by org.codehaus.groovy.reflection.CachedClass
Direct Known Subclasses:
ArrayCachedClass, BooleanCachedClass, CachedClosureClass, CharacterCachedClass, NumberCachedClass, ObjectCachedClass, StringCachedClass

public class CachedClass
extends java.lang.Object

Author:
Alex.Tkachman

Nested Class Summary
static class CachedClass.CachedMethodComparatorByName
           
static class CachedClass.CachedMethodComparatorWithString
           
 
Field Summary
private  java.lang.Class cachedClass
           
private  CachedClass cachedSuperClass
           
private  CachedConstructor[] constructors
           
(package private)  int distance
           
private static MetaMethod[] EMPTY
           
static CachedClass[] EMPTY_ARRAY
           
private  CachedField[] fields
           
(package private)  int hashCode
           
private  java.util.Set interfaces
           
 boolean isArray
           
 boolean isInterface
           
 boolean isNumber
           
 boolean isPrimitive
           
private  java.lang.Object metaClassForClass
           
private  CachedMethod[] methods
           
 int modifiers
           
 CachedMethod[] mopMethods
           
private  MetaMethod[] newMetaMethods
           
private static java.lang.Object NONE
           
private  java.util.Set ownInterfaces
           
private  Reflector reflector
           
private  java.lang.Object staticMetaClassField
           
 
Constructor Summary
CachedClass(java.lang.Class klazz)
           
 
Method Summary
 void box(BytecodeHelper helper)
           
 java.lang.Object coerceArgument(java.lang.Object argument)
           
 void doCast(BytecodeHelper helper)
           
 CachedClass getCachedSuperClass()
          This can't be final because ReflectionClass has an inner class that extends CachedClass for java.lang.Object (ReflectionClass.OBJECT_CLASS) that returns null for this method.
 CachedConstructor[] getConstructors()
           
 CachedField[] getFields()
           
 java.util.Set getInterfaces()
           
 MetaClass getMetaClassForClass()
           
 CachedMethod[] getMethods()
           
 int getModifiers()
           
 java.lang.String getName()
           
 MetaMethod[] getNewMetaMethods()
           
 java.util.Set getOwnInterfaces()
           
 Reflector getReflector()
           
 int getSuperClassDistance()
           
 java.lang.Class getTheClass()
           
 java.lang.String getTypeDescription()
           
 int hashCode()
           
(package private)  void initialize()
          Initialization involves making calls back to ReflectionCache to popuplate the "assignable from" structure.
 boolean isAssignableFrom(java.lang.Class argument)
           
(package private)  boolean isDirectlyAssignable(java.lang.Object argument)
           
 boolean isInterface()
           
 boolean isPrimitive()
           
 boolean isVoid()
           
 CachedMethod searchMethods(java.lang.String name, CachedClass[] parameterTypes)
           
 void setMetaClassForClass(MetaClass metaClassForClass, boolean isConst)
           
 void setNewMopMethods(java.util.ArrayList arr)
           
 void setStaticMetaClassField(MetaClass mc)
           
 java.lang.String toString()
           
 void unbox(BytecodeHelper helper)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

cachedSuperClass

private CachedClass cachedSuperClass

EMPTY

private static final MetaMethod[] EMPTY

hashCode

int hashCode

reflector

private Reflector reflector

metaClassForClass

private volatile java.lang.Object metaClassForClass

fields

private CachedField[] fields

constructors

private CachedConstructor[] constructors

methods

private CachedMethod[] methods

cachedClass

private final java.lang.Class cachedClass

newMetaMethods

private MetaMethod[] newMetaMethods

mopMethods

public CachedMethod[] mopMethods

EMPTY_ARRAY

public static final CachedClass[] EMPTY_ARRAY

staticMetaClassField

private java.lang.Object staticMetaClassField

NONE

private static final java.lang.Object NONE

ownInterfaces

private java.util.Set ownInterfaces

interfaces

private java.util.Set interfaces

isArray

public final boolean isArray

isPrimitive

public final boolean isPrimitive

modifiers

public final int modifiers

distance

int distance

isInterface

public final boolean isInterface

isNumber

public final boolean isNumber
Constructor Detail

CachedClass

public CachedClass(java.lang.Class klazz)
Method Detail

getInterfaces

public java.util.Set getInterfaces()

getOwnInterfaces

public java.util.Set getOwnInterfaces()

initialize

final void initialize()
Initialization involves making calls back to ReflectionCache to popuplate the "assignable from" structure. Package scoped (like our constructor) because ReflectionCache is really the only place we should be called from. We don't need to be synchronized here because ReflectionCache is careful to make sure we're called exactly once. By the same token we could however safely lock ourself. But the idea here is to take out the bad locks.


getCachedSuperClass

public CachedClass getCachedSuperClass()
This can't be final because ReflectionClass has an inner class that extends CachedClass for java.lang.Object (ReflectionClass.OBJECT_CLASS) that returns null for this method.


getMethods

public CachedMethod[] getMethods()

getFields

public CachedField[] getFields()

getConstructors

public CachedConstructor[] getConstructors()

searchMethods

public CachedMethod searchMethods(java.lang.String name,
                                  CachedClass[] parameterTypes)

getModifiers

public final int getModifiers()

coerceArgument

public java.lang.Object coerceArgument(java.lang.Object argument)

getSuperClassDistance

public int getSuperClassDistance()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

isPrimitive

public boolean isPrimitive()

isVoid

public boolean isVoid()

box

public void box(BytecodeHelper helper)

unbox

public void unbox(BytecodeHelper helper)

isInterface

public boolean isInterface()

doCast

public void doCast(BytecodeHelper helper)

getName

public java.lang.String getName()

getTypeDescription

public java.lang.String getTypeDescription()

getReflector

public Reflector getReflector()

getTheClass

public final java.lang.Class getTheClass()

getNewMetaMethods

public MetaMethod[] getNewMetaMethods()

setNewMopMethods

public void setNewMopMethods(java.util.ArrayList arr)

setStaticMetaClassField

public void setStaticMetaClassField(MetaClass mc)

getMetaClassForClass

public MetaClass getMetaClassForClass()

setMetaClassForClass

public void setMetaClassForClass(MetaClass metaClassForClass,
                                 boolean isConst)

isAssignableFrom

public boolean isAssignableFrom(java.lang.Class argument)

isDirectlyAssignable

boolean isDirectlyAssignable(java.lang.Object argument)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © ${year} The Codehaus. All Rights Reserved.