Class ClassInfo
- java.lang.Object
- 
- org.codehaus.groovy.reflection.ClassInfo
 
- 
- All Implemented Interfaces:
- Finalizable
 
 public class ClassInfo extends java.lang.Object implements Finalizable Handle for all information we want to keep about the classThis class handles caching internally and its advisable to not store references directly to objects of this class. The static factory method getClassInfo(Class)should be used to retrieve an instance from the cache. Internally theClassassociated with aClassInfoinstance is kept asWeakReference, so it not safe to reference and instance without the Class being either strongly or softly reachable.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static interfaceClassInfo.ClassInfoAction
 - 
Field SummaryFields Modifier and Type Field Description inthash
 - 
Method Summary
 
- 
- 
- 
Field Detail- 
hashpublic final int hash - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
getVersionpublic int getVersion() 
 - 
incVersionpublic void incVersion() 
 - 
getModifiedExpandopublic ExpandoMetaClass getModifiedExpando() 
 - 
clearModifiedExpandospublic static void clearModifiedExpandos() 
 - 
getTheClasspublic final java.lang.Class<?> getTheClass() Returns theClassassociated with thisClassInfo.This method can return nullif theClassis no longer reachable through any strong or soft references. A non-null return value indicates that thisClassInfois valid.- Returns:
- the Classassociated with thisClassInfo, elsenull
 
 - 
getCachedClasspublic CachedClass getCachedClass() 
 - 
getArtifactClassLoaderpublic ClassLoaderForClassArtifacts getArtifactClassLoader() 
 - 
getClassInfopublic static ClassInfo getClassInfo(java.lang.Class cls) 
 - 
removepublic static void remove(java.lang.Class<?> cls) Removes aClassInfofrom the cache. This is useful in cases where the Class is parsed from a script, such as when using GroovyClassLoader#parseClass, and is executed for its result but the Class is not retained or cached. Removing theClassInfoassociated with the Class will make the Class and its ClassLoader eligible for garbage collection sooner that it would otherwise.- Parameters:
- cls- the Class associated with the ClassInfo to remove from cache
 
 - 
getAllClassInfopublic static java.util.Collection<ClassInfo> getAllClassInfo() 
 - 
onAllClassInfopublic static void onAllClassInfo(ClassInfo.ClassInfoAction action) 
 - 
getStrongMetaClasspublic MetaClass getStrongMetaClass() 
 - 
setStrongMetaClasspublic void setStrongMetaClass(MetaClass answer) 
 - 
getWeakMetaClasspublic MetaClass getWeakMetaClass() 
 - 
setWeakMetaClasspublic void setWeakMetaClass(MetaClass answer) 
 - 
getMetaClassForClasspublic MetaClass getMetaClassForClass() 
 - 
getMetaClasspublic final MetaClass getMetaClass() Returns theMetaClassfor theClassassociated with thisClassInfo. If noMetaClassexists one will be created.It is not safe to call this method without a Classassociated with thisClassInfo. It is advisable to aways retrieve a ClassInfo instance from the cache by using the static factory methodgetClassInfo(Class)to ensure the referenced Class is strongly reachable.- Returns:
- a MetaClassinstance
 
 - 
getMetaClasspublic MetaClass getMetaClass(java.lang.Object obj) 
 - 
sizepublic static int size() 
 - 
fullSizepublic static int fullSize() 
 - 
lockpublic void lock() 
 - 
unlockpublic void unlock() 
 - 
getPerInstanceMetaClasspublic MetaClass getPerInstanceMetaClass(java.lang.Object obj) 
 - 
setPerInstanceMetaClasspublic void setPerInstanceMetaClass(java.lang.Object obj, MetaClass metaClass)
 - 
hasPerInstanceMetaClassespublic boolean hasPerInstanceMetaClasses() 
 - 
finalizeReferencepublic void finalizeReference() - Specified by:
- finalizeReferencein interface- Finalizable
 
 
- 
 
-