Top Fields Constructors Methods
org.codehaus.groovy.runtime.metaclass

public abstract Class OwnedMetaClass

extends DelegatingMetaClass
Class Inheritance
Known Direct Subclasses
org.codehaus.groovy.runtime.metaclass.MixedInMetaClass
Imports
groovy.lang.DelegatingMetaClass, .GroovyObject, .MetaClass, .MetaMethod, .MetaProperty, org.codehaus.groovy.ast.ClassNode, java.util.List

Field Summary

Inherited from groovy.lang.DelegatingMetaClass:
delegate

Constructor Summary

AccessConstructor and Description
public
OwnedMetaClass(final MetaClass delegate)

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides groovy.lang.DelegatingMetaClass.equals.

Indicates whether some other object is "equal to" this one.
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
)

Overrides groovy.lang.DelegatingMetaClass.getAttribute.

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
)

Overrides groovy.lang.DelegatingMetaClass.getAttribute.

Implements groovy.lang.MetaClass.getAttribute.

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

Overrides groovy.lang.DelegatingMetaClass.getClassNode.

Implements groovy.lang.MetaClass.getClassNode.

Obtains a reference to the original AST for the MetaClass if it is available at runtime
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
)

Overrides groovy.lang.DelegatingMetaClass.getMetaMethod.

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 MetaMethod
getMetaMethod(String name, Class<T>[] argTypes)

public List<MetaMethod>
getMetaMethods()

Overrides groovy.lang.DelegatingMetaClass.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
)

Overrides groovy.lang.DelegatingMetaClass.getMetaProperty.

Implements groovy.lang.MetaObjectProtocol.getMetaProperty.

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

Overrides groovy.lang.DelegatingMetaClass.getMethods.

Implements groovy.lang.MetaClass.getMethods.

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

Overrides groovy.lang.DelegatingMetaClass.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
)

Overrides groovy.lang.DelegatingMetaClass.getProperty.

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
)

Overrides groovy.lang.DelegatingMetaClass.getProperty.

Implements groovy.lang.MetaClass.getProperty.

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

public MetaMethod
getStaticMetaMethod(String
The name of the MetaMethod
name
,
Object[]
The argument types
args
)

Overrides groovy.lang.DelegatingMetaClass.getStaticMetaMethod.

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
public Class<T>
getTheClass()

Overrides groovy.lang.DelegatingMetaClass.getTheClass.

Implements groovy.lang.MetaObjectProtocol.getTheClass.

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

Overrides groovy.lang.DelegatingMetaClass.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
)

Overrides groovy.lang.DelegatingMetaClass.hasProperty.

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 Object
invokeConstructor(Object[]
The arguments to the constructor
arguments
)

Overrides groovy.lang.DelegatingMetaClass.invokeConstructor.

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
)

Overrides groovy.lang.DelegatingMetaClass.invokeMethod.

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
)

Overrides groovy.lang.DelegatingMetaClass.invokeMethod.

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
)

Overrides groovy.lang.DelegatingMetaClass.invokeMethod.

Implements groovy.lang.MetaClass.invokeMethod.

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

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
)

Overrides groovy.lang.DelegatingMetaClass.invokeMissingMethod.

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
)

Overrides groovy.lang.DelegatingMetaClass.invokeMissingProperty.

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
)

Overrides groovy.lang.DelegatingMetaClass.invokeStaticMethod.

Implements groovy.lang.MetaObjectProtocol.invokeStaticMethod.

Invokes a static method on the given Object with the given name and arguments.
public boolean
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
)

Overrides groovy.lang.DelegatingMetaClass.respondsTo.

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
)

Overrides groovy.lang.DelegatingMetaClass.respondsTo.

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
)

Overrides groovy.lang.DelegatingMetaClass.selectConstructorAndTransformArguments.

Implements groovy.lang.MetaClass.selectConstructorAndTransformArguments.

Internal method to support Groovy runtime.
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
)

Overrides groovy.lang.DelegatingMetaClass.setAttribute.

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
)

Overrides groovy.lang.DelegatingMetaClass.setAttribute.

Implements groovy.lang.MetaClass.setAttribute.

Sets the value of an attribute (field).
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
)

Overrides groovy.lang.DelegatingMetaClass.setProperty.

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
)

Overrides groovy.lang.DelegatingMetaClass.setProperty.

Implements groovy.lang.MetaClass.setProperty.

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

public String
toString()

Overrides groovy.lang.DelegatingMetaClass.toString.

Returns a string representation of the object.
Inherited from groovy.lang.DelegatingMetaClass:
addMetaBeanPropertyaddMetaMethodaddNewInstanceMethodaddNewStaticMethodgetAdapteegetMetaClassgetPropertyinitializeinvokeMethodisModifiedpickMethodsetAdapteesetMetaClasssetProperty

Constructor Detail

OwnedMetaClassback to summary
public OwnedMetaClass(final MetaClass delegate)

Method Detail

equalsback to summary
public boolean equals(Object obj)

Overrides groovy.lang.DelegatingMetaClass.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.

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

Overrides groovy.lang.DelegatingMetaClass.getAttribute.

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)

Overrides groovy.lang.DelegatingMetaClass.getAttribute.

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()

Overrides groovy.lang.DelegatingMetaClass.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

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

Overrides groovy.lang.DelegatingMetaClass.getMetaMethod.

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

getMetaMethodback to summary
public MetaMethod getMetaMethod(String name, Class<T>[] argTypes)
getMetaMethodsback to summary
public List<MetaMethod> getMetaMethods()

Overrides groovy.lang.DelegatingMetaClass.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)

Overrides groovy.lang.DelegatingMetaClass.getMetaProperty.

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()

Overrides groovy.lang.DelegatingMetaClass.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

Annotations
@Override
getOwnerback to summary
protected abstract Object getOwner()
getOwnerMetaClassback to summary
protected abstract MetaClass getOwnerMetaClass(Object owner)
getPropertiesback to summary
public List<MetaProperty> getProperties()

Overrides groovy.lang.DelegatingMetaClass.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)

Overrides groovy.lang.DelegatingMetaClass.getProperty.

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)

Overrides groovy.lang.DelegatingMetaClass.getProperty.

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

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

Overrides groovy.lang.DelegatingMetaClass.getStaticMetaMethod.

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)

Overrides groovy.lang.DelegatingMetaClass.getStaticMetaMethod.

getTheClassback to summary
public Class<T> getTheClass()

Overrides groovy.lang.DelegatingMetaClass.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 groovy.lang.DelegatingMetaClass.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)

Overrides groovy.lang.DelegatingMetaClass.hasProperty.

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

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

Overrides groovy.lang.DelegatingMetaClass.invokeConstructor.

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)

Overrides groovy.lang.DelegatingMetaClass.invokeMethod.

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)

Overrides groovy.lang.DelegatingMetaClass.invokeMethod.

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)

Overrides groovy.lang.DelegatingMetaClass.invokeMethod.

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

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

Overrides groovy.lang.DelegatingMetaClass.invokeMissingMethod.

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)

Overrides groovy.lang.DelegatingMetaClass.invokeMissingProperty.

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)

Overrides groovy.lang.DelegatingMetaClass.invokeStaticMethod.

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()

Overrides groovy.lang.DelegatingMetaClass.isGroovyObject.

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

Overrides groovy.lang.DelegatingMetaClass.respondsTo.

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)

Overrides groovy.lang.DelegatingMetaClass.respondsTo.

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)

Overrides groovy.lang.DelegatingMetaClass.selectConstructorAndTransformArguments.

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

setAttributeback to summary
public void setAttribute(Object object, String attribute, Object newValue)

Overrides groovy.lang.DelegatingMetaClass.setAttribute.

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)

Overrides groovy.lang.DelegatingMetaClass.setAttribute.

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

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

Overrides groovy.lang.DelegatingMetaClass.setProperty.

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)

Overrides groovy.lang.DelegatingMetaClass.setProperty.

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

toStringback to summary
public String toString()

Overrides groovy.lang.DelegatingMetaClass.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.