groovy.lang
Class MOPIter

Field Summary
 HashMap propNames
           
 boolean useThis
           
 
Constructor Summary
MOPIter()
           
 
Method Summary
Object addElementToList(Object ret, MetaMethod element)
          
void addFields(CachedClass klass, SingleKeyHashMap propertyIndex)
          
void addMetaBeanProperty(MetaBeanProperty mp)
           Adds a new MetaBeanProperty to this MetaClass
void addMetaMethod(MetaMethod method)
           adds a MetaMethod to this class.
void addMetaMethodToIndex(MetaMethod method, def header)
          
void addMetaMethodToSuperIndex(MetaMethod method, def header)
          
void addNewInstanceMethod(Method method)
          
void addNewInstanceMethodToIndex(MetaMethod newMethod, def header)
          
void addNewStaticMethod(Method method)
          
void addNewStaticMethodToIndex(MetaMethod newMethod, def header)
          
void addProperties()
          
void addToAllMethodsIfPublic(MetaMethod metaMethod)
          
void applyPropertyDescriptors(def propertyDescriptors)
          
void applyStrayPropertyMethods(LinkedList superClasses, Index classPropertyIndex, boolean isThis)
          
CachedClass calcFirstGroovySuperClass(Collection superClasses)
          
void checkIfStdMethod(MetaMethod method)
          
void checkInitalised()
           checks if the initialisation of the class id complete.
Object chooseMethod(String methodName, Object methodOrList, def argClasses, boolean coerce)
           Chooses the correct method to use from a list of methods which match by name.
Object chooseMostSpecificParams(String name, List matchingMethods, def arguments)
          
void connectMultimethods(List superClasses, CachedClass firstGroovyClass)
          
void copyClassPropertyIndexForSuper(Index dest)
          
void copyNonPrivateFields(SingleKeyHashMap from, SingleKeyHashMap to)
          
void createMetaBeanProperty(SingleKeyHashMap propertyIndex, String propName, boolean isGetter, MetaMethod propertyMethod)
          
static int distanceToObject(Class c)
          
static Object doConstructorInvoke(Class at, CachedConstructor constructor, def argumentArray, boolean setAccessible)
          
void dropMethodCache(String name)
          
void dropStaticMethodCache(String name)
          
MetaProperty establishStaticMetaProperty(MetaProperty mp)
          
void filterMatchingMethodForCategory(FastArray list, MetaMethod method)
          
int findMatchingMethod(def data, int from, int to, MetaMethod method)
          
MetaMethod findMethod(CachedMethod aMethod)
          
MetaMethod findPropertyMethod(Object methodOrList, boolean isGetter)
          
Object getAttribute(Class sender, Object receiver, String messageName, boolean useSuper)
          
Object getAttribute(Class sender, Object object, String attribute, boolean useSuper, boolean fromInsideClass)
           Looks up the given attribute (field) on the given object
MetaMethod getCategoryMethodGetter(Class sender, String name, boolean useLongVersion)
          
MetaMethod getCategoryMethodSetter(Class sender, String name, boolean useLongVersion)
          
ClassNode getClassNode()
          
Boolean getMatchKindForCategory(MetaMethod aMethod, MetaMethod categoryMethod)
           return false: add method null: ignore method true: replace
List getMetaMethods()
          
MetaProperty getMetaProperty(CachedClass clazz, String name, boolean useSuper, boolean useStatic)
          
MetaMethod getMethodWithCaching(Class sender, String methodName, def arguments, boolean isCallToSuper)
          
MetaMethod getMethodWithoutCaching(Class sender, String methodName, def arguments, boolean isCallToSuper)
          
Object getMethods(Class sender, String name, boolean isCallToSuper)
           given name
List getMethods()
          
MetaMethod getNormalMethodWithCaching(def arguments, def e)
          
String getPropName(String methodName)
          
List getProperties()
           Get all the properties defined for this type
Object getProperty(Class sender, Object object, String name, boolean useSuper, boolean fromInsideClass)
          
Object getStaticMethods(Class sender, String name)
           given name
MetaMethod getSuperMethodWithCaching(def arguments, def e)
          
void inheritFields(LinkedList superClasses)
          
void inheritInterfaceNewMetaMethods(Set interfaces)
          
void inheritMethods(Collection superClasses, CachedClass firstGroovySuper)
          
void inheritStaticInterfaceFields(LinkedList superClasses, Set interfaces)
          
void initialize()
          
Object invokeConstructor(def arguments)
          
Object invokeConstructor(Class at, def arguments)
          
Object invokeConstructorAt(Class at, def arguments)
           Warning, this method will be removed
Object invokeMethod(Object object, String methodName, Object arguments)
          
Object invokeMethod(Object object, String methodName, def originalArguments)
           Invokes the given method on the object.
Object invokeMethod(Class sender, Object object, String methodName, def originalArguments, boolean isCallToSuper, boolean fromInsideClass)
           Invokes the given method on the object.
Object invokeMethodOnGroovyObject(String methodName, def originalArguments, Object owner)
          
Object invokeMissingMethod(Object instance, String methodName, def arguments)
          
Object invokeMissingMethod(Object instance, String methodName, def arguments, RuntimeException original)
          
Object invokeMissingProperty(Object instance, String propertyName, Object optionalValue, boolean isGetter)
          
Object invokeStaticClosureProperty(def originalArguments, Object prop)
          
Object invokeStaticMethod(Object object, String methodName, def arguments)
          
Object invokeStaticMissingMethod(Class sender, String methodName, def arguments)
          
Object invokeStaticMissingProperty(Object instance, String propertyName, Object optionalValue, boolean isGetter)
           Hook to deal with the case of MissingProperty for static properties.
boolean isBeanDerivative(Class theClass)
          
boolean isGenericGetMethod(MetaMethod method)
          
boolean isInitialized()
          
boolean isModified()
          
MetaClass lookupObjectMetaClass(Object object)
          
void makeStaticPropertyIndex()
          
void methodNameAction(Class clazz, def e)
          
MetaMethod pickStaticMethod(String methodName, def arguments)
          
void populateInterfaces(Set interfaces)
          
void processFastArray(FastArray methods)
          
Constructor retrieveConstructor(def argClasses)
          
MetaMethod retrieveStaticMethod(String methodName, def arguments)
          
boolean sameClasses(def params, def arguments, boolean weakNullCheck)
          
int selectConstructorAndTransformArguments(int numberOfCosntructors, def arguments)
          
void setAttribute(Class sender, Object object, String attribute, Object newValue, boolean useSuper, boolean fromInsideClass)
           Sets the given attribute (field) on the given object
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
void setProperty(Class sender, Object object, String name, Object newValue, boolean useSuper, boolean fromInsideClass)
           Sets the property value on an object
void setupProperties(def propertyDescriptors)
           This will build up the property map (Map of MetaProperty objects, keyed on property name).
boolean skipClass(CachedClass clazz)
          
String toString()
          
void unwrap(def arguments)
          
 

Constructor Detail

MOPIter

MOPIter()


Method Detail

addElementToList

Object addElementToList(Object ret, MetaMethod element)


addFields

void addFields(CachedClass klass, SingleKeyHashMap propertyIndex)


addMetaBeanProperty

public void addMetaBeanProperty(MetaBeanProperty mp)
Adds a new MetaBeanProperty to this MetaClass
param:
mp The MetaBeanProperty


addMetaMethod

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.
param:
method the MetaMethod
see:
#initialize()


addMetaMethodToIndex

void addMetaMethodToIndex(MetaMethod method, def header)


addMetaMethodToSuperIndex

void addMetaMethodToSuperIndex(MetaMethod method, def header)


addNewInstanceMethod

public void addNewInstanceMethod(Method method)


addNewInstanceMethodToIndex

void addNewInstanceMethodToIndex(MetaMethod newMethod, def header)


addNewStaticMethod

public void addNewStaticMethod(Method method)


addNewStaticMethodToIndex

void addNewStaticMethodToIndex(MetaMethod newMethod, def header)


addProperties

void addProperties()


addToAllMethodsIfPublic

void addToAllMethodsIfPublic(MetaMethod metaMethod)


applyPropertyDescriptors

void applyPropertyDescriptors(def propertyDescriptors)


applyStrayPropertyMethods

void applyStrayPropertyMethods(LinkedList superClasses, Index classPropertyIndex, boolean isThis)


calcFirstGroovySuperClass

CachedClass calcFirstGroovySuperClass(Collection superClasses)


checkIfStdMethod

void checkIfStdMethod(MetaMethod method)


checkInitalised

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.
throws:
IllegalStateException if the initialisation is incomplete yet


chooseMethod

Object chooseMethod(String methodName, Object methodOrList, def argClasses, boolean coerce)
Chooses the correct method to use from a list of methods which match by name.
param:
methodOrList the possible methods to choose from
param:
argClasses the argument types


chooseMostSpecificParams

Object chooseMostSpecificParams(String name, List matchingMethods, def arguments)


connectMultimethods

void connectMultimethods(List superClasses, CachedClass firstGroovyClass)


copyClassPropertyIndexForSuper

void copyClassPropertyIndexForSuper(Index dest)


copyNonPrivateFields

void copyNonPrivateFields(SingleKeyHashMap from, SingleKeyHashMap to)


createMetaBeanProperty

void createMetaBeanProperty(SingleKeyHashMap propertyIndex, String propName, boolean isGetter, MetaMethod propertyMethod)


distanceToObject

static int distanceToObject(Class c)


doConstructorInvoke

static Object doConstructorInvoke(Class at, CachedConstructor constructor, def argumentArray, boolean setAccessible)


dropMethodCache

void dropMethodCache(String name)


dropStaticMethodCache

void dropStaticMethodCache(String name)


establishStaticMetaProperty

MetaProperty establishStaticMetaProperty(MetaProperty mp)


filterMatchingMethodForCategory

void filterMatchingMethodForCategory(FastArray list, MetaMethod method)


findMatchingMethod

int findMatchingMethod(def data, int from, int to, MetaMethod method)


findMethod

MetaMethod findMethod(CachedMethod aMethod)
return:
the matching method which should be found


findPropertyMethod

MetaMethod findPropertyMethod(Object methodOrList, boolean isGetter)


getAttribute

public Object getAttribute(Class sender, Object receiver, String messageName, boolean useSuper)


getAttribute

public Object getAttribute(Class sender, Object object, String attribute, boolean useSuper, boolean fromInsideClass)
Looks up the given attribute (field) on the given object


getCategoryMethodGetter

MetaMethod getCategoryMethodGetter(Class sender, String name, boolean useLongVersion)


getCategoryMethodSetter

MetaMethod getCategoryMethodSetter(Class sender, String name, boolean useLongVersion)


getClassNode

public ClassNode getClassNode()


getMatchKindForCategory

Boolean getMatchKindForCategory(MetaMethod aMethod, MetaMethod categoryMethod)
return false: add method null: ignore method true: replace


getMetaMethods

public List getMetaMethods()


getMetaProperty

MetaProperty getMetaProperty(CachedClass clazz, String name, boolean useSuper, boolean useStatic)


getMethodWithCaching

public MetaMethod getMethodWithCaching(Class sender, String methodName, def arguments, boolean isCallToSuper)


getMethodWithoutCaching

public MetaMethod getMethodWithoutCaching(Class sender, String methodName, def arguments, boolean isCallToSuper)


getMethods

Object getMethods(Class sender, String name, boolean isCallToSuper)
return:
all the normal instance methods avaiable on this class for the
given name


getMethods

public List getMethods()


getNormalMethodWithCaching

MetaMethod getNormalMethodWithCaching(def arguments, def e)


getPropName

String getPropName(String methodName)


getProperties

public List getProperties()
Get all the properties defined for this type
return:
a list of MetaProperty objects


getProperty

public Object getProperty(Class sender, Object object, String name, boolean useSuper, boolean fromInsideClass)
return:
the given property's value on the object


getStaticMethods

Object getStaticMethods(Class sender, String name)
return:
all the normal static methods avaiable on this class for the
given name


getSuperMethodWithCaching

MetaMethod getSuperMethodWithCaching(def arguments, def e)


inheritFields

void inheritFields(LinkedList superClasses)


inheritInterfaceNewMetaMethods

void inheritInterfaceNewMetaMethods(Set interfaces)


inheritMethods

void inheritMethods(Collection superClasses, CachedClass firstGroovySuper)


inheritStaticInterfaceFields

void inheritStaticInterfaceFields(LinkedList superClasses, Set interfaces)


initialize

public void initialize()


invokeConstructor

public Object invokeConstructor(def arguments)


invokeConstructor

Object invokeConstructor(Class at, def arguments)


invokeConstructorAt

public Object invokeConstructorAt(Class at, def arguments)
Warning, this method will be removed
deprecated:
use invokeConstructor instead


invokeMethod

public Object invokeMethod(Object object, String methodName, Object arguments)


invokeMethod

public Object invokeMethod(Object object, String methodName, def originalArguments)
Invokes the given method on the object. TODO: should this be deprecated? If so, we have to propogate to many places.


invokeMethod

public Object invokeMethod(Class sender, Object object, String methodName, def originalArguments, boolean isCallToSuper, boolean fromInsideClass)
Invokes the given method on the object.


invokeMethodOnGroovyObject

Object invokeMethodOnGroovyObject(String methodName, def originalArguments, Object owner)


invokeMissingMethod

public Object invokeMissingMethod(Object instance, String methodName, def arguments)


invokeMissingMethod

Object invokeMissingMethod(Object instance, String methodName, def arguments, RuntimeException original)


invokeMissingProperty

public Object invokeMissingProperty(Object instance, String propertyName, Object optionalValue, boolean isGetter)


invokeStaticClosureProperty

Object invokeStaticClosureProperty(def originalArguments, Object prop)


invokeStaticMethod

public Object invokeStaticMethod(Object object, String methodName, def arguments)


invokeStaticMissingMethod

Object invokeStaticMissingMethod(Class sender, String methodName, def arguments)


invokeStaticMissingProperty

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
param:
instance The instance
param:
propertyName The name of the property
param:
optionalValue The value in the case of a setter
param:
isGetter True if its a getter
return:
The value in the case of a getter or a MissingPropertyException


isBeanDerivative

boolean isBeanDerivative(Class theClass)


isGenericGetMethod

boolean isGenericGetMethod(MetaMethod method)


isInitialized

boolean isInitialized()


isModified

public boolean isModified()


lookupObjectMetaClass

MetaClass lookupObjectMetaClass(Object object)


makeStaticPropertyIndex

void makeStaticPropertyIndex()


methodNameAction

public void methodNameAction(Class clazz, def e)


pickStaticMethod

MetaMethod pickStaticMethod(String methodName, def arguments)


populateInterfaces

void populateInterfaces(Set interfaces)


processFastArray

void processFastArray(FastArray methods)


retrieveConstructor

public Constructor retrieveConstructor(def argClasses)


retrieveStaticMethod

public MetaMethod retrieveStaticMethod(String methodName, def arguments)


sameClasses

boolean sameClasses(def params, def arguments, boolean weakNullCheck)


selectConstructorAndTransformArguments

public int selectConstructorAndTransformArguments(int numberOfCosntructors, def arguments)


setAttribute

public void setAttribute(Class sender, Object object, String attribute, Object newValue, boolean useSuper, boolean fromInsideClass)
Sets the given attribute (field) on the given object


setProperties

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


setProperty

public void setProperty(Class sender, Object object, String name, Object newValue, boolean useSuper, boolean fromInsideClass)
Sets the property value on an object


setupProperties

void setupProperties(def propertyDescriptors)
This will build up the property map (Map of MetaProperty objects, keyed on property name).


skipClass

public boolean skipClass(CachedClass clazz)


toString

public String toString()


unwrap

void unwrap(def arguments)