Package groovy.util

# Class Expando

java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.util.Expando

All Implemented Interfaces:
  `GroovyObject`

public class Expando extends GroovyObjectSupport
Represents a dynamically expandable bean.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Expando()`
  Creates an empty expando.
  `Expando(Map expandoProperties)`
  Creates an expando backed by the supplied properties.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected Map`
  `createMap()`
  Factory method to create a new Map used to store the expando properties map
  `boolean`
  `equals(Object obj)`
  This allows equals to be overridden by a closure field method attached to the expando object.
  `List`
  `getMetaPropertyValues()`
  Returns meta-properties representing the current dynamic properties.
  `Map`
  `getProperties()`
  `Object`
  `getProperty(String property)`
  Resolves a property from the dynamic property map before normal lookup.
  `int`
  `hashCode()`
  This allows hashCode to be overridden by a closure field method attached to the expando object.
  `Object`
  `invokeMethod(String name, Object args)`
  Invokes a declared method or a closure stored as a dynamic property.
  `void`
  `setProperty(String property, Object newValue)`
  Stores a dynamic property.
  `String`
  `toString()`
  This allows toString to be overridden by a closure field method attached to the expando object.

  ### Methods inherited from class groovy.lang.GroovyObjectSupport

  `getMetaClass, setMetaClass`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### Expando

    public Expando()
    Creates an empty expando.

  - ### Expando

    public Expando(Map expandoProperties)
    Creates an expando backed by the supplied properties.
    Parameters:
      `expandoProperties` - the initial properties map

- ## Method Details

  - ### getProperties

    public Map getProperties()
    Returns:
      the dynamically expanded properties

  - ### getMetaPropertyValues

    public List getMetaPropertyValues()
    Returns meta-properties representing the current dynamic properties.
    Returns:
      the meta-property values

  - ### getProperty

    public Object getProperty(String property)
    Resolves a property from the dynamic property map before normal lookup.
    Parameters:
      `property` - the property name
    Returns:
      the property value, or `null` if it is not defined

  - ### setProperty

    public void setProperty(String property, Object newValue)
    Stores a dynamic property.
    Parameters:
      `property` - the property name
      `newValue` - the property value

  - ### invokeMethod

    public Object invokeMethod(String name, Object args)
    Invokes a declared method or a closure stored as a dynamic property.
    Parameters:
      `name` - the method name
      `args` - the invocation arguments
    Returns:
      the invocation result

  - ### toString

    public String toString()
    This allows toString to be overridden by a closure field method attached to the expando object.
    Overrides:
      `toString` in class `Object`
    See Also:
      - `Object.toString()`

  - ### equals

    public boolean equals(Object obj)
    This allows equals to be overridden by a closure field method attached to the expando object.
    Overrides:
      `equals` in class `Object`
    See Also:
      - `Object.equals(java.lang.Object)`

  - ### hashCode

    public int hashCode()
    This allows hashCode to be overridden by a closure field method attached to the expando object.
    Overrides:
      `hashCode` in class `Object`
    See Also:
      - `Object.hashCode()`

  - ### createMap

    protected Map createMap()
    Factory method to create a new Map used to store the expando properties map
    Returns:
      a newly created Map implementation