Class GroovyObjectWrapper
java.lang.Object
org.codehaus.groovy.runtime.wrappers.Wrapper
org.codehaus.groovy.runtime.wrappers.GroovyObjectWrapper
- All Implemented Interfaces:
GroovyObject
Wraps an existing
GroovyObject while constraining the type it should
present to the runtime.-
Field Summary
FieldsFields inherited from class org.codehaus.groovy.runtime.wrappers.Wrapper
constrainedType -
Constructor Summary
ConstructorsConstructorDescriptionGroovyObjectWrapper(GroovyObject wrapped, Class constrainedType) Creates a wrapper for a Groovy object constrained to the supplied type. -
Method Summary
Modifier and TypeMethodDescriptionprotected MetaClassReturns the meta class that should handle GroovyObject operations for the wrapped value.getProperty(String property) Returns a property value from the wrapped Groovy object.protected ObjectReturns the object used as the delegation target for meta-class-based operations.invokeMethod(String name, Object args) Invokes a method on the wrapped Groovy object.voidsetMetaClass(MetaClass metaClass) Updates the wrapped object's meta class.voidsetProperty(String property, Object newValue) Sets a property on the wrapped Groovy object.unwrap()Returns the wrapped value.Methods inherited from class org.codehaus.groovy.runtime.wrappers.Wrapper
getMetaClass, getType
-
Field Details
-
wrapped
The wrapped Groovy object.
-
-
Constructor Details
-
GroovyObjectWrapper
Creates a wrapper for a Groovy object constrained to the supplied type.- Parameters:
wrapped- the wrapped Groovy objectconstrainedType- the type the wrapped object should report
-
-
Method Details
-
unwrap
Returns the wrapped value. -
getProperty
Returns a property value from the wrapped Groovy object.- Parameters:
property- the property name- Returns:
- the resolved property value
-
invokeMethod
Invokes a method on the wrapped Groovy object.- Parameters:
name- the method nameargs- the invocation arguments- Returns:
- the invocation result
-
setMetaClass
Updates the wrapped object's meta class.- Parameters:
metaClass- the new meta class
-
setProperty
Sets a property on the wrapped Groovy object.- Parameters:
property- the property namenewValue- the new property value
-
getWrapped
Returns the object used as the delegation target for meta-class-based operations.- Specified by:
getWrappedin classWrapper- Returns:
- the underlying wrapped object
-
getDelegatedMetaClass
Returns the meta class that should handle GroovyObject operations for the wrapped value.- Specified by:
getDelegatedMetaClassin classWrapper- Returns:
- the delegated meta class
-