W3cubDocs

/Groovy 3.0

[Java] Interface GroovyObject

public interface GroovyObject

The interface implemented by all Groovy objects.

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

Methods Summary

Methods
Type Params Return Type Name and description
public MetaClass getMetaClass()
Returns the metaclass for a given class.
public Object getProperty(String propertyName)
Retrieves a property value.
public Object invokeMethod(String name, Object args)
Invokes the given method.
public void setMetaClass(MetaClass metaClass)
Allows the MetaClass to be replaced with a derived implementation.
public void setProperty(String propertyName, Object newValue)
Sets the given property to the new value.

Method Detail

public MetaClass getMetaClass()

Returns the metaclass for a given class.

Returns:
the metaClass of this instance

@Internal public Object getProperty(String propertyName)

Retrieves a property value.

Parameters:
propertyName - the name of the property of interest
Returns:
the given property

@Internal public Object invokeMethod(String name, 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

public void setMetaClass(MetaClass metaClass)

Allows the MetaClass to be replaced with a derived implementation.

Parameters:
metaClass - the new metaclass

@Internal public void setProperty(String propertyName, 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

© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/3.0.7/html/gapi/groovy/lang/GroovyObject.html