Package groovy.util
Class Expando
java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.util.Expando
- All Implemented Interfaces:
GroovyObject
Represents a dynamically expandable bean.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected MapFactory method to create a new Map used to store the expando properties mapbooleanThis allows equals to be overridden by a closure field method attached to the expando object.Returns meta-properties representing the current dynamic properties.getProperty(String property) Resolves a property from the dynamic property map before normal lookup.inthashCode()This allows hashCode to be overridden by a closure field method attached to the expando object.invokeMethod(String name, Object args) Invokes a declared method or a closure stored as a dynamic property.voidsetProperty(String property, Object newValue) Stores a dynamic property.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
-
Constructor Details
-
Expando
public Expando()Creates an empty expando. -
Expando
Creates an expando backed by the supplied properties.- Parameters:
expandoProperties- the initial properties map
-
-
Method Details
-
getProperties
- Returns:
- the dynamically expanded properties
-
getMetaPropertyValues
Returns meta-properties representing the current dynamic properties.- Returns:
- the meta-property values
-
getProperty
Resolves a property from the dynamic property map before normal lookup.- Parameters:
property- the property name- Returns:
- the property value, or
nullif it is not defined
-
setProperty
Stores a dynamic property.- Parameters:
property- the property namenewValue- the property value
-
invokeMethod
Invokes a declared method or a closure stored as a dynamic property.- Parameters:
name- the method nameargs- the invocation arguments- Returns:
- the invocation result
-
toString
This allows toString to be overridden by a closure field method attached to the expando object. -
equals
This allows equals to be overridden by a closure field method attached to the expando object. -
hashCode
public int hashCode()This allows hashCode to be overridden by a closure field method attached to the expando object. -
createMap
Factory method to create a new Map used to store the expando properties map- Returns:
- a newly created Map implementation
-