Save This Page
Home » groovy-src-1.6.3 » groovy » lang » [javadoc | source]
groovy.lang
public class: MetaClassImpl [javadoc | source]
java.lang.Object
   groovy.lang.MetaClassImpl

All Implemented Interfaces:
    MetaClass, MutableMetaClass

Direct Known Subclasses:
    ClosureMetaClass, ExpandoMetaClass, ProxyMetaClass, MockProxyMetaClass

Allows methods to be dynamically added to existing classes at runtime
Nested Class Summary:
class  MetaClassImpl.MethodIndex   
public static class  MetaClassImpl.Index   
Field Summary
protected static final  String STATIC_METHOD_MISSING     
protected static final  String STATIC_PROPERTY_MISSING     
protected static final  String METHOD_MISSING     
protected static final  String PROPERTY_MISSING     
protected static final  String INVOKE_METHOD_METHOD     
protected final  Class theClass     
protected final  CachedClass theCachedClass     
protected  MetaMethod getPropertyMethod     
protected  MetaMethod invokeMethodMethod     
protected  MetaMethod setPropertyMethod     
protected  MetaClassRegistry registry     
protected final  boolean isGroovyObject     
protected final  boolean isMap     
protected final  MetaMethodIndex metaMethodIndex     
Constructor:
 public MetaClassImpl(Class theClass) 
 public MetaClassImpl(Class theClass,
    MetaMethod[] add) 
 public MetaClassImpl(MetaClassRegistry registry,
    Class theClass) 
 public MetaClassImpl(MetaClassRegistry registry,
    Class theClass,
    MetaMethod[] add) 
Method from groovy.lang.MetaClassImpl Summary:
addMetaBeanProperty,   addMetaMethod,   addMetaMethodToIndex,   addNewInstanceMethod,   addNewStaticMethod,   checkIfGroovyObjectMethod,   checkInitalised,   chooseMethod,   clearInvocationCaches,   createConstructorSite,   createPogoCallCurrentSite,   createPogoCallSite,   createPojoCallSite,   createStaticSite,   dropMethodCache,   dropStaticMethodCache,   findMethodInClassHierarchy,   findMixinMethod,   findOwnMethod,   findPropertyInClassHierarchy,   getAdditionalMetaMethods,   getAttribute,   getAttribute,   getAttribute,   getClassInfo,   getClassNode,   getEffectiveGetMetaProperty,   getMetaMethod,   getMetaMethods,   getMetaProperty,   getMethodWithCaching,   getMethodWithoutCaching,   getMethods,   getProperties,   getProperty,   getProperty,   getStaticMetaMethod,   getSubclassMetaMethods,   getSuperClasses,   getTheCachedClass,   getTheClass,   getVersion,   hasProperty,   incVersion,   initialize,   invokeConstructor,   invokeConstructorAt,   invokeMethod,   invokeMethod,   invokeMethod,   invokeMissingMethod,   invokeMissingProperty,   invokeStaticMethod,   invokeStaticMissingProperty,   isGroovyObject,   isInitialized,   isModified,   onGetPropertyFoundInHierarchy,   onInvokeMethodFoundInHierarchy,   onMixinMethodFound,   onSetPropertyFoundInHierarchy,   onSuperMethodFoundInHierarchy,   onSuperPropertyFoundInHierarchy,   pickMethod,   respondsTo,   respondsTo,   retrieveConstructor,   retrieveMethod,   retrieveStaticMethod,   selectConstructorAndTransformArguments,   setAttribute,   setAttribute,   setProperties,   setProperty,   setProperty,   toString
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from groovy.lang.MetaClassImpl Detail:
 public  void addMetaBeanProperty(MetaBeanProperty mp) 
    Adds a new MetaBeanProperty to this MetaClass
 public  void addMetaMethod(MetaMethod method) 
    adds a MetaMethod to this class. WARNING: this method will not do the neccessary steps for multimethod logic and using this method doesn't mean, that a method added here is replacing another method from a parent class completely. These steps are usually done by initalize, which means if you need these steps, you have to add the method before running initialize the first time.
 protected  void addMetaMethodToIndex(MetaMethod method,
    Header header) 
 public  void addNewInstanceMethod(Method method) 
 public  void addNewStaticMethod(Method method) 
 protected final  void checkIfGroovyObjectMethod(MetaMethod metaMethod) 
    Checks if the metaMethod is a method from the GroovyObject interface such as setProperty, getProperty and invokeMethod
 protected  void checkInitalised() 
    checks if the initialisation of the class id complete. This method should be called as a form of assert, it is no way to test if there is still initialisation work to be done. Such logic must be implemented in a different way.
 protected Object chooseMethod(String methodName,
    Object methodOrList,
    Class[] arguments) 
    Chooses the correct method to use from a list of methods which match by name.
 protected  void clearInvocationCaches() 
    remove all method call cache entries. This should be done if a method is added during runtime, but not by using a category.
 public CallSite createConstructorSite(CallSite site,
    Object[] args) 
 public CallSite createPogoCallCurrentSite(CallSite site,
    Class sender,
    Object[] args) 
 public CallSite createPogoCallSite(CallSite site,
    Object[] args) 
 public CallSite createPojoCallSite(CallSite site,
    Object receiver,
    Object[] args) 
 public CallSite createStaticSite(CallSite site,
    Object[] args) 
 protected  void dropMethodCache(String name) 
 protected  void dropStaticMethodCache(String name) 
 protected static MetaMethod findMethodInClassHierarchy(Class instanceKlazz,
    String methodName,
    Class[] arguments,
    MetaClass metaClass) 
 protected MetaMethod findMixinMethod(String methodName,
    Class[] arguments) 
 protected static MetaMethod findOwnMethod(Class instanceKlazz,
    String methodName,
    Class[] arguments,
    MetaClass metaClass,
    MetaMethod method) 
 protected MetaBeanProperty findPropertyInClassHierarchy(String propertyName,
    CachedClass theClass) 
 public MetaMethod[] getAdditionalMetaMethods() 
 public Object getAttribute(Object object,
    String attribute) 
 public Object getAttribute(Class sender,
    Object receiver,
    String messageName,
    boolean useSuper) 
 public Object getAttribute(Class sender,
    Object object,
    String attribute,
    boolean useSuper,
    boolean fromInsideClass) 
    Looks up the given attribute (field) on the given object
 public ClassInfo getClassInfo() 
 public ClassNode getClassNode() 
 public MetaProperty getEffectiveGetMetaProperty(Class sender,
    Object object,
    String name,
    boolean useSuper) 
 public MetaMethod getMetaMethod(String name,
    Object[] argTypes) 
 public List getMetaMethods() 
 public MetaProperty getMetaProperty(String name) 
 public MetaMethod getMethodWithCaching(Class sender,
    String methodName,
    Object[] arguments,
    boolean isCallToSuper) 
 public MetaMethod getMethodWithoutCaching(Class sender,
    String methodName,
    Class[] arguments,
    boolean isCallToSuper) 
 public List getMethods() 
 public List getProperties() 
    Get all the properties defined for this type
 public Object getProperty(Object object,
    String property) 
 public Object getProperty(Class sender,
    Object object,
    String name,
    boolean useSuper,
    boolean fromInsideClass) 
 public MetaMethod getStaticMetaMethod(String name,
    Object[] argTypes) 
 protected Object getSubclassMetaMethods(String methodName) 
 protected LinkedList getSuperClasses() 
 public final CachedClass getTheCachedClass() 
 public Class getTheClass() 
 public int getVersion() 
 public MetaProperty hasProperty(Object obj,
    String name) 
 public  void incVersion() 
 public synchronized  void initialize() 
 public Object invokeConstructor(Object[] arguments) 
 public Object invokeConstructorAt(Class at,
    Object[] arguments) 
Deprecated! use - invokeConstructor instead

    Warning, this method will be removed
 public Object invokeMethod(Object object,
    String methodName,
    Object arguments) 
 public Object invokeMethod(Object object,
    String methodName,
    Object[] originalArguments) 
    Invokes the given method on the object. TODO: should this be deprecated? If so, we have to propogate to many places.
 public Object invokeMethod(Class sender,
    Object object,
    String methodName,
    Object[] originalArguments,
    boolean isCallToSuper,
    boolean fromInsideClass) 
    Invokes the given method on the object.
 public Object invokeMissingMethod(Object instance,
    String methodName,
    Object[] arguments) 
 public Object invokeMissingProperty(Object instance,
    String propertyName,
    Object optionalValue,
    boolean isGetter) 
 public Object invokeStaticMethod(Object object,
    String methodName,
    Object[] arguments) 
 protected Object invokeStaticMissingProperty(Object instance,
    String propertyName,
    Object optionalValue,
    boolean isGetter) 
    Hook to deal with the case of MissingProperty for static properties. The method will look attempt to look up "propertyMissing" handlers and invoke them otherwise thrown a MissingPropertyException
 public boolean isGroovyObject() 
 protected boolean isInitialized() 
 public boolean isModified() 
 protected  void onGetPropertyFoundInHierarchy(MetaMethod method) 
 protected  void onInvokeMethodFoundInHierarchy(MetaMethod method) 
 protected  void onMixinMethodFound(MetaMethod method) 
 protected  void onSetPropertyFoundInHierarchy(MetaMethod method) 
 protected  void onSuperMethodFoundInHierarchy(MetaMethod method) 
 protected  void onSuperPropertyFoundInHierarchy(MetaBeanProperty property) 
 public MetaMethod pickMethod(String methodName,
    Class[] arguments) 
 public List respondsTo(Object obj,
    String name) 
 public List respondsTo(Object obj,
    String name,
    Object[] argTypes) 
 public Constructor retrieveConstructor(Class[] arguments) 
 protected MetaMethod retrieveMethod(String methodName,
    Class[] arguments) 
Deprecated! use - pickMethod instead

 public MetaMethod retrieveStaticMethod(String methodName,
    Object[] arguments) 
 public int selectConstructorAndTransformArguments(int numberOfConstructors,
    Object[] arguments) 
 public  void setAttribute(Object object,
    String attribute,
    Object newValue) 
 public  void setAttribute(Class sender,
    Object object,
    String attribute,
    Object newValue,
    boolean useSuper,
    boolean fromInsideClass) 
    Sets the given attribute (field) on the given object
 public  void setProperties(Object bean,
    Map map) 
    Sets a number of bean properties from the given Map where the keys are the String names of properties and the values are the values of the properties to set
 public  void setProperty(Object object,
    String property,
    Object newValue) 
 public  void setProperty(Class sender,
    Object object,
    String name,
    Object newValue,
    boolean useSuper,
    boolean fromInsideClass) 
    Sets the property value on an object
 public String toString()