Top Fields Constructors Methods
groovy.lang

public Class DelegatingMetaClass

extends Object
implements MetaClass, MutableMetaClass, GroovyObject
Class Inheritance
All Implemented Interfaces
groovy.lang.GroovyObject, groovy.lang.MutableMetaClass, groovy.lang.MetaClass, groovy.lang.MetaObjectProtocol
Known Direct Subclasses
groovy.util.FactoryInterceptorMetaClass, org.codehaus.groovy.runtime.HandleMetaClass, org.codehaus.groovy.runtime.metaclass.OwnedMetaClass
Imports
org.codehaus.groovy.ast.ClassNode, org.codehaus.groovy.runtime.InvokerHelper, java.lang.reflect.Method, java.util.List

Field Summary

Modifier and TypeField and Description
protected MetaClass

Constructor Summary

AccessConstructor and Description
public
public
DelegatingMetaClass(final Class<T> theClass)

Method Summary

Modifier and TypeMethod and Description
public void
addMetaBeanProperty(MetaBeanProperty
The MetaBeanProperty instance
metaBeanProperty
)

Implements groovy.lang.MutableMetaClass.addMetaBeanProperty.

Adds a new MetaBeanProperty to the MetaClass
public void
addMetaMethod(MetaMethod
The MetaMethod to add
metaMethod
)

Implements groovy.lang.MutableMetaClass.addMetaMethod.

Adds a new MetaMethod to the MetaClass
public void
addNewInstanceMethod(Method
the method to be added
method
)

Implements groovy.lang.MutableMetaClass.addNewInstanceMethod.

adds a new instance method to this MetaClass.
public void
addNewStaticMethod(Method
the method to be added
method
)

Implements groovy.lang.MutableMetaClass.addNewStaticMethod.

adds a new static method to this MetaClass.
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public MetaClass
public Object
getAttribute(Object
An instance of the class returned by the getTheClass() method
object
,
String
The name of the attribute to retrieve the value for
attribute
)

Implements groovy.lang.MetaObjectProtocol.getAttribute.

Retrieves an attribute of an instance of the class returned by the getTheClass() method.
public Object
getAttribute(Class<T>
The class of the object that requested the attribute
sender
,
Object
The instance
receiver
,
String
The name of the attribute
messageName
,
boolean
Whether to look-up on the super class or not
useSuper
)

Implements groovy.lang.MetaClass.getAttribute.

Retrieves the value of an attribute (field).
public ClassNode
getClassNode()

Implements groovy.lang.MetaClass.getClassNode.

Obtains a reference to the original AST for the MetaClass if it is available at runtime
public MetaClass
getMetaClass()

Implements groovy.lang.GroovyObject.getMetaClass.

Returns the metaclass for a given class.
public MetaMethod
getMetaMethod(String
The name of the MetaMethod
name
,
Object[]
Array containing - 1) the argument values (using which their types are then inferred), or 2) the corresponding argument types
args
)

Implements groovy.lang.MetaObjectProtocol.getMetaMethod.

Retrieves an instance MetaMethod for the given name and argument values, using the types of the argument values to establish the chosen MetaMethod
public List<MetaMethod>
getMetaMethods()

Implements groovy.lang.MetaClass.getMetaMethods.

Retrieves a list of MetaMethods held by this class.
public MetaProperty
getMetaProperty(String
The name of the MetaProperty
name
)

Implements groovy.lang.MetaObjectProtocol.getMetaProperty.

Returns a MetaProperty for the given name or null if it doesn't exist
public List<MetaMethod>
getMethods()

Implements groovy.lang.MetaClass.getMethods.

Retrieves a list of MetaMethods held by the class.
public List<MetaProperty>
getProperties()

Implements groovy.lang.MetaClass.getProperties.

Retrieves a list of MetaProperty instances that the MetaClass has
public Object
getProperty(Object
An instance of the class returned by the getTheClass() method
object
,
String
The name of the property to retrieve the value for
property
)

Implements groovy.lang.MetaObjectProtocol.getProperty.

Retrieves a property of an instance of the class returned by the getTheClass() method.
public Object
getProperty(Class<T>
The java.lang.Class instance that requested the property
sender
,
Object
The Object which the property is being retrieved from
receiver
,
String
The name of the property
messageName
,
boolean
Whether the call is to a super class property
useSuper
,
boolean
??
fromInsideClass
)

Implements groovy.lang.MetaClass.getProperty.

Retrieves a property on the given receiver for the specified arguments.

public Object
getProperty(String
the name of the property of interest
property
)

Overrides default groovy.lang.GroovyObject.getProperty.

Retrieves a property value.
public MetaMethod
getStaticMetaMethod(String
The name of the MetaMethod
name
,
Object[]
The argument types
args
)

Implements groovy.lang.MetaObjectProtocol.getStaticMetaMethod.

Retrieves a static MetaMethod for the given name and argument values, using the types of the arguments to establish the chosen MetaMethod
public MetaMethod
getStaticMetaMethod(String name, Class<T>[] argTypes)

public Class<T>
getTheClass()

Implements groovy.lang.MetaObjectProtocol.getTheClass.

Retrieves that Java Class that the attached Meta behaviours apply to
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public MetaProperty
hasProperty(Object
The object to inspect
obj
,
String
The name of the property
name
)

Implements groovy.lang.MetaObjectProtocol.hasProperty.

Returns true of the implementing MetaClass has a property of the given name

Note that this method will only return true for realised properties and does not take into account implementation of getProperty or propertyMissing

public void
initialize()

Implements groovy.lang.MetaClass.initialize.

Complete the initialisation process.
public Object
invokeConstructor(Object[]
The arguments to the constructor
arguments
)

Implements groovy.lang.MetaObjectProtocol.invokeConstructor.

Invokes a constructor for the given arguments.
public Object
invokeMethod(Object
The Object to invoke the method on
object
,
String
The name of the method
methodName
,
Object
The argument to the method
arguments
)

Implements groovy.lang.MetaObjectProtocol.invokeMethod.

Invokes a method on the given object, with the given name and single argument.
public Object
invokeMethod(Object
The instance which the method is invoked on
object
,
String
The name of the method
methodName
,
Object[]
The arguments to the method
arguments
)

Implements groovy.lang.MetaObjectProtocol.invokeMethod.

Invokes a method on the given Object with the given name and arguments.
public Object
invokeMethod(Class<T>
The java.lang.Class instance that invoked the method
sender
,
Object
The object which the method was invoked on
receiver
,
String
The name of the method
methodName
,
Object[]
The arguments to the method
arguments
,
boolean
Whether the method is a call to a super class method
isCallToSuper
,
boolean
Whether the call was invoked from the inside or the outside of the class
fromInsideClass
)

Implements groovy.lang.MetaClass.invokeMethod.

Invokes a method on the given receiver for the specified arguments.

public Object
invokeMethod(String
the name of the method to call
name
,
Object
the arguments to use for the method call
args
)

Overrides default groovy.lang.GroovyObject.invokeMethod.

Invokes the given method.
public Object
invokeMissingMethod(Object
The instance to invoke methodMissing on
instance
,
String
The name of the method
methodName
,
Object[]
The arguments to the method
arguments
)

Implements groovy.lang.MetaClass.invokeMissingMethod.

Attempts to invoke the methodMissing method otherwise throws a MissingMethodException

public Object
invokeMissingProperty(Object
The instance of the class
instance
,
String
The name of the property
propertyName
,
Object
The value of the property which could be null in the case of a getter
optionalValue
,
boolean
Whether the missing property event was the result of a getter or a setter
isGetter
)

Implements groovy.lang.MetaClass.invokeMissingProperty.

Invokes the propertyMissing method otherwise throws a MissingPropertyException
public Object
invokeStaticMethod(Object
An instance of the class returned by the getTheClass() method or the class itself
object
,
String
The name of the method
methodName
,
Object[]
The arguments to the method
arguments
)

Implements groovy.lang.MetaObjectProtocol.invokeStaticMethod.

Invokes a static method on the given Object with the given name and arguments.
public boolean
public boolean
isModified()

Implements groovy.lang.MutableMetaClass.isModified.

Return whether the MetaClass has been modified or not
public MetaMethod
pickMethod(String
the name of the method to pick
methodName
,
Class<T>[]
the method arguments
arguments
)

Implements groovy.lang.MetaClass.pickMethod.

Deprecated
Selects a method by name and argument classes.
public List<MetaMethod>
respondsTo(Object
The object to inspect
obj
,
String
The name of the method of interest
name
,
Object[]
The argument types to match against
argTypes
)

Implements groovy.lang.MetaObjectProtocol.respondsTo.

Returns an object satisfying Groovy truth if the implementing MetaClass responds to a method with the given name and arguments types.

public List<MetaMethod>
respondsTo(Object
The object to inspect
obj
,
String
The name of the method of interest
name
)

Implements groovy.lang.MetaObjectProtocol.respondsTo.

Returns an object satisfying Groovy truth if the implementing MetaClass responds to a method with the given name regardless of arguments.

public int
selectConstructorAndTransformArguments(int
The number of constructors
numberOfConstructors
,
Object[]
The arguments
arguments
)

Implements groovy.lang.MetaClass.selectConstructorAndTransformArguments.

Internal method to support Groovy runtime.
public void
public void
setAttribute(Object
An instance of the class returned by the getTheClass() method
object
,
String
The name of the attribute to set
attribute
,
Object
The new value of the attribute
newValue
)

Implements groovy.lang.MetaObjectProtocol.setAttribute.

Sets an attribute of an instance of the class returned by the getTheClass() method.
public void
setAttribute(Class<T>
The class of the object that requested the attribute
sender
,
Object
The instance
receiver
,
String
The name of the attribute
messageName
,
Object
The value of the attribute
messageValue
,
boolean
Whether to look-up on the super class or not
useSuper
,
boolean
Whether the call happened from the inside or the outside of a class
fromInsideClass
)

Implements groovy.lang.MetaClass.setAttribute.

Sets the value of an attribute (field).
public void
setMetaClass(MetaClass
the new metaclass
metaClass
)

Implements groovy.lang.GroovyObject.setMetaClass.

Allows the MetaClass to be replaced with a derived implementation.
public void
setProperty(Object
An instance of the class returned by the getTheClass() method
object
,
String
The name of the property to set
property
,
Object
The new value of the property
newValue
)

Implements groovy.lang.MetaObjectProtocol.setProperty.

Sets a property of an instance of the class returned by the getTheClass() method.
public void
setProperty(Class<T>
The java.lang.Class instance that is mutating the property
sender
,
Object
The Object which the property is being set on
receiver
,
String
The name of the property
messageName
,
Object
The new value of the property to set
messageValue
,
boolean
Whether the call is to a super class property
useSuper
,
boolean
Whether the call was invoked from the inside or the outside of the class
fromInsideClass
)

Implements groovy.lang.MetaClass.setProperty.

Sets a property on the given receiver for the specified arguments.

public void
setProperty(String
the name of the property of interest
property
,
Object
the new value for the property
newValue
)

Overrides default groovy.lang.GroovyObject.setProperty.

Sets the given property to the new value.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

delegateback to summary
protected MetaClass delegate

Constructor Detail

DelegatingMetaClassback to summary
public DelegatingMetaClass(final MetaClass delegate)
DelegatingMetaClassback to summary
public DelegatingMetaClass(final Class<T> theClass)

Method Detail

addMetaBeanPropertyback to summary
public void addMetaBeanProperty(MetaBeanProperty metaBeanProperty)

Implements groovy.lang.MutableMetaClass.addMetaBeanProperty.

Doc from groovy.lang.MutableMetaClass.addMetaBeanProperty.

Adds a new MetaBeanProperty to the MetaClass

Parameters
metaBeanProperty:MetaBeanProperty

The MetaBeanProperty instance

addMetaMethodback to summary
public void addMetaMethod(MetaMethod metaMethod)

Implements groovy.lang.MutableMetaClass.addMetaMethod.

Doc from groovy.lang.MutableMetaClass.addMetaMethod.

Adds a new MetaMethod to the MetaClass

Parameters
metaMethod:MetaMethod

The MetaMethod to add

addNewInstanceMethodback to summary
public void addNewInstanceMethod(Method method)

Implements groovy.lang.MutableMetaClass.addNewInstanceMethod.

Doc from groovy.lang.MutableMetaClass.addNewInstanceMethod.

adds a new instance method to this MetaClass. Instance methods are able to overwrite the original methods of the class. Calling this method should not be done after initialise was called.

Parameters
method:Method

the method to be added

addNewStaticMethodback to summary
public void addNewStaticMethod(Method method)

Implements groovy.lang.MutableMetaClass.addNewStaticMethod.

Doc from groovy.lang.MutableMetaClass.addNewStaticMethod.

adds a new static method to this MetaClass. This is only possible as long as initialise was not called.

Parameters
method:Method

the method to be added

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

getAdapteeback to summary
public MetaClass getAdaptee()
getAttributeback to summary
public Object getAttribute(Object object, String attribute)

Implements groovy.lang.MetaObjectProtocol.getAttribute.

Doc from groovy.lang.MetaObjectProtocol.getAttribute.

Retrieves an attribute of an instance of the class returned by the getTheClass() method.

What this means is largely down to the MetaClass implementation, however the default case would result in attempt to read a field of the instance.

Parameters
object:Object

An instance of the class returned by the getTheClass() method

attribute:String

The name of the attribute to retrieve the value for

Returns:Object

The attribute value

getAttributeback to summary
public Object getAttribute(Class<T> sender, Object receiver, String messageName, boolean useSuper)

Implements groovy.lang.MetaClass.getAttribute.

Doc from groovy.lang.MetaClass.getAttribute.

Retrieves the value of an attribute (field). This method is to support the Groovy runtime and not for general client API usage.

Parameters
sender:Class<T>

The class of the object that requested the attribute

receiver:Object

The instance

messageName:String

The name of the attribute

useSuper:boolean

Whether to look-up on the super class or not

Returns:Object

The attribute value

getClassNodeback to summary
public ClassNode getClassNode()

Implements groovy.lang.MetaClass.getClassNode.

Doc from groovy.lang.MetaClass.getClassNode.

Obtains a reference to the original AST for the MetaClass if it is available at runtime

Returns:ClassNode

The original AST or null if it cannot be returned

getMetaClassback to summary
public MetaClass getMetaClass()

Implements groovy.lang.GroovyObject.getMetaClass.

Doc from groovy.lang.GroovyObject.getMetaClass.

Returns the metaclass for a given class.

Returns:MetaClass

the metaClass of this instance

getMetaMethodback to summary
public MetaMethod getMetaMethod(String name, Object[] args)

Implements groovy.lang.MetaObjectProtocol.getMetaMethod.

Doc from groovy.lang.MetaObjectProtocol.getMetaMethod.

Retrieves an instance MetaMethod for the given name and argument values, using the types of the argument values to establish the chosen MetaMethod

Parameters
name:String

The name of the MetaMethod

args:Object[]

Array containing - 1) the argument values (using which their types are then inferred), or 2) the corresponding argument types

Returns:MetaMethod

A MetaMethod or null if it doesn't exist

getMetaMethodsback to summary
public List<MetaMethod> getMetaMethods()

Implements groovy.lang.MetaClass.getMetaMethods.

Doc from groovy.lang.MetaClass.getMetaMethods.

Retrieves a list of MetaMethods held by this class. This list includes MetaMethods added by groovy.lang.ExpandoMetaClass.

Returns:List<MetaMethod>

A list of MetaMethods

getMetaPropertyback to summary
public MetaProperty getMetaProperty(String name)

Implements groovy.lang.MetaObjectProtocol.getMetaProperty.

Doc from groovy.lang.MetaObjectProtocol.getMetaProperty.

Returns a MetaProperty for the given name or null if it doesn't exist

Parameters
name:String

The name of the MetaProperty

Returns:MetaProperty

A MetaProperty or null

getMethodsback to summary
public List<MetaMethod> getMethods()

Implements groovy.lang.MetaClass.getMethods.

Doc from groovy.lang.MetaClass.getMethods.

Retrieves a list of MetaMethods held by the class. This list does not include MetaMethods added by groovy.lang.ExpandoMetaClass.

Returns:List<MetaMethod>

A list of MetaMethods

getPropertiesback to summary
public List<MetaProperty> getProperties()

Implements groovy.lang.MetaClass.getProperties.

Doc from groovy.lang.MetaClass.getProperties.

Retrieves a list of MetaProperty instances that the MetaClass has

Returns:List<MetaProperty>

A list of MetaProperty instances

getPropertyback to summary
public Object getProperty(Object object, String property)

Implements groovy.lang.MetaObjectProtocol.getProperty.

Doc from groovy.lang.MetaObjectProtocol.getProperty.

Retrieves a property of an instance of the class returned by the getTheClass() method.

What this means is largely down to the MetaClass implementation, however the default case would result in an attempt to invoke a JavaBean getter, or if no such getter exists a public field of the instance.

Parameters
object:Object

An instance of the class returned by the getTheClass() method

property:String

The name of the property to retrieve the value for

Returns:Object

The properties value

getPropertyback to summary
public Object getProperty(Class<T> sender, Object receiver, String messageName, boolean useSuper, boolean fromInsideClass)

Implements groovy.lang.MetaClass.getProperty.

Doc from groovy.lang.MetaClass.getProperty.

Retrieves a property on the given receiver for the specified arguments. The sender is the class that is requesting the property from the object. The MetaClass will attempt to establish the method to invoke based on the name and arguments provided.

The isCallToSuper and fromInsideClass help the Groovy runtime perform optimisations on the call to go directly to the super class if necessary

Parameters
sender:Class<T>

The java.lang.Class instance that requested the property

receiver:Object

The Object which the property is being retrieved from

messageName:String

The name of the property

useSuper:boolean

Whether the call is to a super class property

fromInsideClass:boolean

??

Returns:Object

The properties value

getPropertyback to summary
public Object getProperty(String property)

Overrides default groovy.lang.GroovyObject.getProperty.

Doc from groovy.lang.GroovyObject.getProperty.

Retrieves a property value.

Parameters
property:String

the name of the property of interest

Returns:Object

the given property

getStaticMetaMethodback to summary
public MetaMethod getStaticMetaMethod(String name, Object[] args)

Implements groovy.lang.MetaObjectProtocol.getStaticMetaMethod.

Doc from groovy.lang.MetaObjectProtocol.getStaticMetaMethod.

Retrieves a static MetaMethod for the given name and argument values, using the types of the arguments to establish the chosen MetaMethod

Parameters
name:String

The name of the MetaMethod

args:Object[]

The argument types

Returns:MetaMethod

A MetaMethod or null if it doesn't exist

getStaticMetaMethodback to summary
public MetaMethod getStaticMetaMethod(String name, Class<T>[] argTypes)
getTheClassback to summary
public Class<T> getTheClass()

Implements groovy.lang.MetaObjectProtocol.getTheClass.

Doc from groovy.lang.MetaObjectProtocol.getTheClass.

Retrieves that Java Class that the attached Meta behaviours apply to

Returns:Class<T>

The java.lang.Class instance

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

hasPropertyback to summary
public MetaProperty hasProperty(Object obj, String name)

Implements groovy.lang.MetaObjectProtocol.hasProperty.

Doc from groovy.lang.MetaObjectProtocol.hasProperty.

Returns true of the implementing MetaClass has a property of the given name

Note that this method will only return true for realised properties and does not take into account implementation of getProperty or propertyMissing

Parameters
obj:Object

The object to inspect

name:String

The name of the property

Returns:MetaProperty

The MetaProperty or null if it doesn't exist

initializeback to summary
public void initialize()

Implements groovy.lang.MetaClass.initialize.

Doc from groovy.lang.MetaClass.initialize.

Complete the initialisation process. After this method is called no methods should be added to the meta class. Invocation of methods or access to fields/properties is forbidden unless this method is called. This method should contain any initialisation code, taking a longer time to complete. An example is the creation of the Reflector. It is suggested to synchronize this method.

invokeConstructorback to summary
public Object invokeConstructor(Object[] arguments)

Implements groovy.lang.MetaObjectProtocol.invokeConstructor.

Doc from groovy.lang.MetaObjectProtocol.invokeConstructor.

Invokes a constructor for the given arguments. The MetaClass will attempt to pick the best argument which matches the types of the objects passed within the arguments array

Parameters
arguments:Object[]

The arguments to the constructor

Returns:Object

An instance of the java.lang.Class that this MetaObjectProtocol object applies to

invokeMethodback to summary
public Object invokeMethod(Object object, String methodName, Object arguments)

Implements groovy.lang.MetaObjectProtocol.invokeMethod.

Doc from groovy.lang.MetaObjectProtocol.invokeMethod.

Invokes a method on the given object, with the given name and single argument.

Parameters
object:Object

The Object to invoke the method on

methodName:String

The name of the method

arguments:Object

The argument to the method

Returns:Object

The return value of the method which is null if the return type is void

invokeMethodback to summary
public Object invokeMethod(Object object, String methodName, Object[] arguments)

Implements groovy.lang.MetaObjectProtocol.invokeMethod.

Doc from groovy.lang.MetaObjectProtocol.invokeMethod.

Invokes a method on the given Object with the given name and arguments. The MetaClass will attempt to pick the best method for the given name and arguments. If a method cannot be invoked a MissingMethodException will be thrown.

Parameters
object:Object

The instance which the method is invoked on

methodName:String

The name of the method

arguments:Object[]

The arguments to the method

Returns:Object

The return value of the method which is null if the return type is void

invokeMethodback to summary
public Object invokeMethod(Class<T> sender, Object receiver, String methodName, Object[] arguments, boolean isCallToSuper, boolean fromInsideClass)

Implements groovy.lang.MetaClass.invokeMethod.

Doc from groovy.lang.MetaClass.invokeMethod.

Invokes a method on the given receiver for the specified arguments. The sender is the class that invoked the method on the object. The MetaClass will attempt to establish the method to invoke based on the name and arguments provided.

The isCallToSuper and fromInsideClass help the Groovy runtime perform optimisations on the call to go directly to the super class if necessary

Parameters
sender:Class<T>

The java.lang.Class instance that invoked the method

receiver:Object

The object which the method was invoked on

methodName:String

The name of the method

arguments:Object[]

The arguments to the method

isCallToSuper:boolean

Whether the method is a call to a super class method

fromInsideClass:boolean

Whether the call was invoked from the inside or the outside of the class

Returns:Object

The return value of the method

invokeMethodback to summary
public Object invokeMethod(String name, Object args)

Overrides default groovy.lang.GroovyObject.invokeMethod.

Doc from groovy.lang.GroovyObject.invokeMethod.

Invokes the given method.

Parameters
name:String

the name of the method to call

args:Object

the arguments to use for the method call

Returns:Object

the result of invoking the method

invokeMissingMethodback to summary
public Object invokeMissingMethod(Object instance, String methodName, Object[] arguments)

Implements groovy.lang.MetaClass.invokeMissingMethod.

Doc from groovy.lang.MetaClass.invokeMissingMethod.

Attempts to invoke the methodMissing method otherwise throws a MissingMethodException

Parameters
instance:Object

The instance to invoke methodMissing on

methodName:String

The name of the method

arguments:Object[]

The arguments to the method

Returns:Object

The results of methodMissing or throws MissingMethodException

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

Implements groovy.lang.MetaClass.invokeMissingProperty.

Doc from groovy.lang.MetaClass.invokeMissingProperty.

Invokes the propertyMissing method otherwise throws a MissingPropertyException

Parameters
instance:Object

The instance of the class

propertyName:String

The name of the property

optionalValue:Object

The value of the property which could be null in the case of a getter

isGetter:boolean

Whether the missing property event was the result of a getter or a setter

Returns:Object

The result of the propertyMissing method or throws MissingPropertyException

invokeStaticMethodback to summary
public Object invokeStaticMethod(Object object, String methodName, Object[] arguments)

Implements groovy.lang.MetaObjectProtocol.invokeStaticMethod.

Doc from groovy.lang.MetaObjectProtocol.invokeStaticMethod.

Invokes a static method on the given Object with the given name and arguments.

The Object can either be an instance of the class that this MetaObjectProtocol instance applies to or the java.lang.Class instance itself. If a method cannot be invoked a MissingMethodException is will be thrown

Parameters
object:Object

An instance of the class returned by the getTheClass() method or the class itself

methodName:String

The name of the method

arguments:Object[]

The arguments to the method

Returns:Object

The return value of the method which is null if the return type is void

isGroovyObjectback to summary
public boolean isGroovyObject()
isModifiedback to summary
public boolean isModified()

Implements groovy.lang.MutableMetaClass.isModified.

Doc from groovy.lang.MutableMetaClass.isModified.

Return whether the MetaClass has been modified or not

Returns:boolean

True if it has

pickMethodback to summary
public MetaMethod pickMethod(String methodName, Class<T>[] arguments)

Implements groovy.lang.MetaClass.pickMethod.

Doc from groovy.lang.MetaClass.pickMethod.

Deprecated

Selects a method by name and argument classes. This method does not search for an exact match, it searches for a compatible method. For this the method selection mechanism is used as provided by the implementation of this MetaClass. pickMethod may or may not be used during the method selection process when invoking a method. There is no warranty for that.

Parameters
methodName:String

the name of the method to pick

arguments:Class<T>[]

the method arguments

Returns:MetaMethod

a matching MetaMethod or null

Annotations
@Deprecated
respondsToback to summary
public List<MetaMethod> respondsTo(Object obj, String name, Object[] argTypes)

Implements groovy.lang.MetaObjectProtocol.respondsTo.

Doc from groovy.lang.MetaObjectProtocol.respondsTo.

Returns an object satisfying Groovy truth if the implementing MetaClass responds to a method with the given name and arguments types.

Note that this method's return value is based on realised methods and does not take into account objects or classes that implement invokeMethod or methodMissing

This method is "safe" in that it will always return a value and never throw an exception

Parameters
obj:Object

The object to inspect

name:String

The name of the method of interest

argTypes:Object[]

The argument types to match against

Returns:List<MetaMethod>

A List of MetaMethods matching the argument types which will be empty if no matching methods exist

respondsToback to summary
public List<MetaMethod> respondsTo(Object obj, String name)

Implements groovy.lang.MetaObjectProtocol.respondsTo.

Doc from groovy.lang.MetaObjectProtocol.respondsTo.

Returns an object satisfying Groovy truth if the implementing MetaClass responds to a method with the given name regardless of arguments. In other words this method will return for foo() and foo(String).

Note that this method's return value is based on realised methods and does not take into account objects or classes that implement invokeMethod or methodMissing

This method is "safe" in that it will always return a value and never throw an exception

Parameters
obj:Object

The object to inspect

name:String

The name of the method of interest

Returns:List<MetaMethod>

A List of MetaMethods which will be empty if no methods with the given name exist

selectConstructorAndTransformArgumentsback to summary
public int selectConstructorAndTransformArguments(int numberOfConstructors, Object[] arguments)

Implements groovy.lang.MetaClass.selectConstructorAndTransformArguments.

Doc from groovy.lang.MetaClass.selectConstructorAndTransformArguments.

Internal method to support Groovy runtime. Not for client usage.

Parameters
numberOfConstructors:int

The number of constructors

arguments:Object[]

The arguments

Returns:int

selected index

setAdapteeback to summary
public void setAdaptee(MetaClass adaptee)
setAttributeback to summary
public void setAttribute(Object object, String attribute, Object newValue)

Implements groovy.lang.MetaObjectProtocol.setAttribute.

Doc from groovy.lang.MetaObjectProtocol.setAttribute.

Sets an attribute of an instance of the class returned by the getTheClass() method.

What this means is largely down to the MetaClass implementation, however the default case would result in an attempt to set a field of the instance.

Parameters
object:Object

An instance of the class returned by the getTheClass() method

attribute:String

The name of the attribute to set

newValue:Object

The new value of the attribute

setAttributeback to summary
public void setAttribute(Class<T> sender, Object receiver, String messageName, Object messageValue, boolean useSuper, boolean fromInsideClass)

Implements groovy.lang.MetaClass.setAttribute.

Doc from groovy.lang.MetaClass.setAttribute.

Sets the value of an attribute (field). This method is to support the Groovy runtime and not for general client API usage.

Parameters
sender:Class<T>

The class of the object that requested the attribute

receiver:Object

The instance

messageName:String

The name of the attribute

messageValue:Object

The value of the attribute

useSuper:boolean

Whether to look-up on the super class or not

fromInsideClass:boolean

Whether the call happened from the inside or the outside of a class

setMetaClassback to summary
public void setMetaClass(MetaClass metaClass)

Implements groovy.lang.GroovyObject.setMetaClass.

Doc from groovy.lang.GroovyObject.setMetaClass.

Allows the MetaClass to be replaced with a derived implementation.

Parameters
metaClass:MetaClass

the new metaclass

setPropertyback to summary
public void setProperty(Object object, String property, Object newValue)

Implements groovy.lang.MetaObjectProtocol.setProperty.

Doc from groovy.lang.MetaObjectProtocol.setProperty.

Sets a property of an instance of the class returned by the getTheClass() method.

What this means is largely down to the MetaClass implementation, however the default case would result in an attempt to invoke a JavaBean setter, or if no such setter exists to set a public field of the instance.

Parameters
object:Object

An instance of the class returned by the getTheClass() method

property:String

The name of the property to set

newValue:Object

The new value of the property

setPropertyback to summary
public void setProperty(Class<T> sender, Object receiver, String messageName, Object messageValue, boolean useSuper, boolean fromInsideClass)

Implements groovy.lang.MetaClass.setProperty.

Doc from groovy.lang.MetaClass.setProperty.

Sets a property on the given receiver for the specified arguments. The sender is the class that is setting the property from the object. The MetaClass will attempt to establish the method to invoke based on the name and arguments provided.

The isCallToSuper and fromInsideClass help the Groovy runtime perform optimisations on the call to go directly to the super class if necessary

Parameters
sender:Class<T>

The java.lang.Class instance that is mutating the property

receiver:Object

The Object which the property is being set on

messageName:String

The name of the property

messageValue:Object

The new value of the property to set

useSuper:boolean

Whether the call is to a super class property

fromInsideClass:boolean

Whether the call was invoked from the inside or the outside of the class

setPropertyback to summary
public void setProperty(String property, Object newValue)

Overrides default groovy.lang.GroovyObject.setProperty.

Doc from groovy.lang.GroovyObject.setProperty.

Sets the given property to the new value.

Parameters
property:String

the name of the property of interest

newValue:Object

the new value for the property

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.