groovy.lang
Interface ExpandoMetaClass

Field Summary
 String CLASS
           
 String CLASS_PROPERTY
           
 String CONSTRUCTOR
           
 String GET_PROPERTY_METHOD
           
 String GROOVY_CONSTRUCTOR
           
 String INVOKE_METHOD_METHOD
           
 String META_CLASS
           
 String META_CLASS_PROPERTY
           
 String META_METHODS
           
 String METHODS
           
 String PROPERTIES
           
 String SET_PROPERTY_METHOD
           
 String STATIC_QUALIFIER
           
 def ZERO_ARGUMENTS
           
 boolean allowChangesAfterInit
           
 Map beanPropertyCache
           
 Map expandoMethods
           
 Map expandoProperties
           
 ClosureMetaMethod getPropertyMethod
           
 boolean inRegistry
           
 Set inheritedMetaMethods
           
 boolean initCalled
           
 boolean initialized
           
 ClosureMetaMethod invokeMethodMethod
           
 ClosureStaticMetaMethod invokeStaticMethodMethod
           
 boolean modified
           
 MetaClass myMetaClass
           
 ClosureMetaMethod setPropertyMethod
           
 Map staticBeanPropertyCache
           
 
Constructor Summary
ExpandoMetaClass(Class theClass)
            Constructs a new ExpandoMetaClass instance for the given class
ExpandoMetaClass(Class theClass, boolean register)
            Constructs a new ExpandoMetaClass instance for the given class optionally placing the MetaClass in the MetaClassRegistry automatically
ExpandoMetaClass(Class theClass, boolean register, boolean allowChangesAfterInit)
            Constructs a new ExpandoMetaClass instance for the given class optionally placing the MetaClass in the MetaClassRegistry automatically
 
Method Summary
void addSuperMethodIfNotOverriden(MetaMethod metaMethodFromSuper)
          
void call()
          
static void disableGlobally()
           Call to disable the global use of ExpandoMetaClass
static void enableGlobally()
           Call to enable global use of global use of ExpandoMetaClass within the registry.
MetaMethod findMethodInClassHeirarchy(String methodName, def arguments, Class theClass)
          
MetaBeanProperty findPropertyInClassHierarchy(String propertyName, CachedClass theClass)
          
MetaMethod getMetaMethodFromMutableMetaClass(String methodName, def arguments, MetaClass metaClass)
          
MetaBeanProperty getMetaPropertyFromMutableMetaClass(String propertyName, MetaClass metaClass)
          
void initialize()
          
Object invokeMissingMethod(Object instance, String methodName, def arguments)
           Overrides the default missing method behaviour and adds the capability to look up a method from super class
Object invokeMissingProperty(Object instance, String propertyName, Object optionalValue, boolean isGetter)
           Overrides the default missing method behaviour and adds the capability to look up a method from the super class in the case where it has been overriden
boolean isInitialized()
          
boolean isModified()
          
MetaMethod searchInterfacesForMetaMethod(String methodName, def arguments, def interfaces)
          
MetaBeanProperty searchInterfacesForMetaProperty(String propertyName, def interfaces)
          
void setInitialized(boolean b)
          
 

Constructor Detail

ExpandoMetaClass

public ExpandoMetaClass(Class theClass)
Constructs a new ExpandoMetaClass instance for the given class
param:
theClass The class that the MetaClass applies to


ExpandoMetaClass

public ExpandoMetaClass(Class theClass, boolean register)
Constructs a new ExpandoMetaClass instance for the given class optionally placing the MetaClass in the MetaClassRegistry automatically
param:
theClass The class that the MetaClass applies to
param:
register True if the MetaClass should be registered inside the MetaClassRegistry. This defaults to true and ExpandoMetaClass will effect all instances if changed


ExpandoMetaClass

public ExpandoMetaClass(Class theClass, boolean register, boolean allowChangesAfterInit)
Constructs a new ExpandoMetaClass instance for the given class optionally placing the MetaClass in the MetaClassRegistry automatically
param:
theClass The class that the MetaClass applies to
param:
register True if the MetaClass should be registered inside the MetaClassRegistry. This defaults to true and ExpandoMetaClass will effect all instances if changed
param:
allowChangesAfterInit Should the meta class be modifiable after initialization. Default is false.


Method Detail

addSuperMethodIfNotOverriden

void addSuperMethodIfNotOverriden(MetaMethod metaMethodFromSuper)


call

public void call()


disableGlobally

public static void disableGlobally()
Call to disable the global use of ExpandoMetaClass


enableGlobally

public static void enableGlobally()
Call to enable global use of global use of ExpandoMetaClass within the registry. This has the advantage that inheritance will function correctly, but has a higher memory usage on the JVM than normal Groovy


findMethodInClassHeirarchy

MetaMethod findMethodInClassHeirarchy(String methodName, def arguments, Class theClass)


findPropertyInClassHierarchy

MetaBeanProperty findPropertyInClassHierarchy(String propertyName, CachedClass theClass)


getMetaMethodFromMutableMetaClass

MetaMethod getMetaMethodFromMutableMetaClass(String methodName, def arguments, MetaClass metaClass)


getMetaPropertyFromMutableMetaClass

MetaBeanProperty getMetaPropertyFromMutableMetaClass(String propertyName, MetaClass metaClass)


initialize

public void initialize()


invokeMissingMethod

public Object invokeMissingMethod(Object instance, String methodName, def arguments)
Overrides the default missing method behaviour and adds the capability to look up a method from super class
see:
MetaClassImpl#invokeMissingMethod(Object, String, Object[])


invokeMissingProperty

public Object invokeMissingProperty(Object instance, String propertyName, Object optionalValue, boolean isGetter)
Overrides the default missing method behaviour and adds the capability to look up a method from the super class in the case where it has been overriden
param:
instance The instance of the object
param:
propertyName The property name
param:
optionalValue The property value in the case of a setter
param:
isGetter True if it is a getter
return:
The return value if of a getProperty call or a MissingPropertyException is thrown


isInitialized

boolean isInitialized()


isModified

public boolean isModified()


searchInterfacesForMetaMethod

MetaMethod searchInterfacesForMetaMethod(String methodName, def arguments, def interfaces)


searchInterfacesForMetaProperty

MetaBeanProperty searchInterfacesForMetaProperty(String propertyName, def interfaces)


setInitialized

void setInitialized(boolean b)