Top Description Fields Constructors Methods
groovy.lang

public Class Binding

extends GroovyObjectSupport
Class Inheritance
Known Direct Subclasses
groovy.util.FactoryBuilderSupport
Imports
java.util.LinkedHashMap, .Map

Represents the variable bindings of a script which can be altered from outside the script object or created outside of a script and passed into it.

Binding instances are not supposed to be used in a multi-threaded context.

Field Summary

Modifier and TypeField and Description
private Map<K, V>

Constructor Summary

AccessConstructor and Description
public
public
Binding(Map<K, V> variables)

public
Binding(String[]
are the command line arguments from a main()
args
)

A helper constructor used in main(String[]) method calls

Method Summary

Modifier and TypeMethod and Description
public Object
getProperty(String
the name of the property of interest
property
)

Overrides default groovy.lang.GroovyObject.getProperty.

Overloaded to make variables appear as bean properties or via the subscript operator
public Object

Returns:

the variable value
getVariable
(String
the name of the variable to lookup
name
)

public Map<K, V>
public boolean
hasVariable(String
the name of the variable to check for
name
)

Simple check for whether the binding contains a particular variable or not.

public void
removeVariable(String
the name of the variable to remove
name
)

remove the variable with the specified name

public void
setProperty(String
the name of the property of interest
property
,
Object
the new value for the property
newValue
)

Overrides default groovy.lang.GroovyObject.setProperty.

Overloaded to make variables appear as bean properties or via the subscript operator
public void
setVariable(String
the name of the variable to set
name
,
Object
the new value for the given variable
value
)

Sets the value of the given variable

Inherited from groovy.lang.GroovyObjectSupport:
getMetaClasssetMetaClass

Field Detail

variablesback to summary
private Map<K, V> variables

Constructor Detail

Bindingback to summary
public Binding()
Bindingback to summary
public Binding(Map<K, V> variables)
Bindingback to summary
public Binding(String[] args)

A helper constructor used in main(String[]) method calls

Parameters
args:String[]

are the command line arguments from a main()

Method Detail

getPropertyback to summary
public Object getProperty(String property)

Overrides default groovy.lang.GroovyObject.getProperty.

Overloaded to make variables appear as bean properties or via the subscript operator

Parameters
property:String

Doc from groovy.lang.GroovyObject.getProperty.

the name of the property of interest

Returns:Object

Doc from groovy.lang.GroovyObject.getProperty.

the given property

getVariableback to summary
public Object getVariable(String name)
Parameters
name:String

the name of the variable to lookup

Returns:Object

the variable value

getVariablesback to summary
public Map<K, V> getVariables()
hasVariableback to summary
public boolean hasVariable(String name)

Simple check for whether the binding contains a particular variable or not.

Parameters
name:String

the name of the variable to check for

removeVariableback to summary
public void removeVariable(String name)

remove the variable with the specified name

Parameters
name:String

the name of the variable to remove

setPropertyback to summary
public void setProperty(String property, Object newValue)

Overrides default groovy.lang.GroovyObject.setProperty.

Overloaded to make variables appear as bean properties or via the subscript operator

Parameters
property:String

Doc from groovy.lang.GroovyObject.setProperty.

the name of the property of interest

newValue:Object

Doc from groovy.lang.GroovyObject.setProperty.

the new value for the property

setVariableback to summary
public void setVariable(String name, Object value)

Sets the value of the given variable

Parameters
name:String

the name of the variable to set

value:Object

the new value for the given variable