Package groovy.lang

# Interface GroovyObject

All Known Subinterfaces:
  `GroovyInterceptable`, `GroovyResultSet`

All Known Implementing Classes:
  `AntBuilder`, `Attribute`, `Attributes`, `BaseMarkupBuilder`, `BatchingPreparedStatementWrapper`, `BatchingStatementWrapper`, `Binding`, `BindingProxy`, `BooleanWrapper`, `Builder`, `Builder.Built`, `BuilderSupport`, `ByteWrapper`, `CharWrapper`, `Closure`, `ComposedClosure`, `ConfigObject`, `CurriedClosure`, `DelegatingMetaClass`, `DelegatingScript`, `DOMBuilder`, `DoubleWrapper`, `Expando`, `ExpandoMetaClass`, `ExpandoMetaClass.ExpandoMetaConstructor`, `ExpandoMetaClass.ExpandoMetaProperty`, `FactoryBuilderSupport`, `FilteredAttributes`, `FilteredNodeChildren`, `FloatWrapper`, `GPathResult`, `GroovyMBean`, `GroovyObjectSupport`, `GroovyObjectWrapper`, `GroovyResultSetExtension`, `GroovyRowResult`, `GroovyShell`, `GroovyTypeCheckingExtensionSupport.TypeCheckingDSL`, `GString`, `GStringImpl`, `HandleMetaClass`, `IntWrapper`, `IteratorClosureAdapter`, `JsonBuilder`, `JsonDelegate`, `LongWrapper`, `MarkupBuilder`, `MessageSource`, `MethodClosure`, `MixedInMetaClass`, `NamespaceBuilderSupport`, `NoChildren`, `NodeBuilder`, `NodeChild`, `NodeChildren`, `NodeParents`, `NonEmptySequence`, `NullObject`, `ObjectGraphBuilder`, `OwnedMetaClass`, `PojoWrapper`, `Proxy`, `Reference`, `ResultSetMetaDataWrapper`, `SAXBuilder`, `Script`, `ScriptReference`, `Sequence`, `ServletBinding`, `ShortWrapper`, `StreamingJsonBuilder`, `StreamingJsonBuilder.StreamingJsonDelegate`, `TomlBuilder`, `Wrapper`, `YamlBuilder`

public interface GroovyObject
The interface implemented by all Groovy objects.

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `MetaClass`
  `getMetaClass()`
  Returns the metaclass for a given class.
  `default Object`
  `getProperty(String propertyName)`
  Retrieves a property value.
  `default Object`
  `invokeMethod(String name, Object args)`
  Invokes the given method.
  `void`
  `setMetaClass(MetaClass metaClass)`
  Allows the MetaClass to be replaced with a derived implementation.
  `default void`
  `setProperty(String propertyName, Object newValue)`
  Sets the given property to the new value.

- ## Method Details

  - ### invokeMethod

    default 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

  - ### getProperty

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

  - ### setProperty

    default 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

  - ### getMetaClass

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

  - ### setMetaClass

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