Groovy Documentation

groovy.lang
[Java] Interface GroovyObject


public interface GroovyObject

The interface implemented by all Groovy objects.

Especially handy for using Groovy objects when in the Java world.

Authors:
James Strachan
Version:
\$Revision\$


Method Summary
MetaClass getMetaClass()

Returns the metaclass for a given class.

java.lang.Object getProperty(java.lang.String propertyName)

Retrieves a property value.

java.lang.Object invokeMethod(java.lang.String name, java.lang.Object args)

Invokes the given method.

void setMetaClass(MetaClass metaClass)

Allows the MetaClass to be replaced with a derived implementation.

void setProperty(java.lang.String propertyName, java.lang.Object newValue)

Sets the given property to the new value.

 

Method Detail

getMetaClass

public MetaClass getMetaClass()
Returns the metaclass for a given class.
Returns:
the metaClass of this instance


getProperty

public java.lang.Object getProperty(java.lang.String propertyName)
Retrieves a property value.
Parameters:
propertyName - the name of the property of interest
Returns:
the given property


invokeMethod

public java.lang.Object invokeMethod(java.lang.String name, java.lang.Object args)
Invokes the given method.
Parameters:
name - the name of the method to call
args - the arguments to use for the method call
Returns:
the result of invoking the method


setMetaClass

public void setMetaClass(MetaClass metaClass)
Allows the MetaClass to be replaced with a derived implementation.
Parameters:
metaClass - the new metaclass


setProperty

public void setProperty(java.lang.String propertyName, java.lang.Object newValue)
Sets the given property to the new value.
Parameters:
propertyName - the name of the property of interest
newValue - the new value for the property


 

Groovy Documentation