|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovy.lang.GroovyObjectSupport groovy.lang.Binding
public class Binding extends GroovyObjectSupport
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 multithreaded context.
Constructor Summary | |
Binding()
|
|
Binding(java.util.Map variables)
|
|
Binding(java.lang.String[] args)
A helper constructor used in main(String[]) method calls |
Method Summary | |
---|---|
java.lang.Object
|
getProperty(java.lang.String property)
Overloaded to make variables appear as bean properties or via the subscript operator |
java.lang.Object
|
getVariable(java.lang.String name)
@param name the name of the variable to lookup |
java.util.Map
|
getVariables()
|
boolean
|
hasVariable(java.lang.String name)
Simple check for whether the binding contains a particular variable or not. |
void
|
setProperty(java.lang.String property, java.lang.Object newValue)
@todo we should check if we have the property with the metaClass instead of try/catch |
void
|
setVariable(java.lang.String name, java.lang.Object value)
Sets the value of the given variable |
Methods inherited from class GroovyObjectSupport | |
---|---|
getMetaClass, getProperty, invokeMethod, setMetaClass, setProperty |
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Constructor Detail |
---|
public Binding()
public Binding(java.util.Map variables)
public Binding(java.lang.String[] args)
args
- are the command line arguments from a main()
Method Detail |
---|
public java.lang.Object getProperty(java.lang.String property)
public java.lang.Object getVariable(java.lang.String name)
name
- the name of the variable to lookup
public java.util.Map getVariables()
public boolean hasVariable(java.lang.String name)
name
- the name of the variable to check for
public void setProperty(java.lang.String property, java.lang.Object newValue)
public void setVariable(java.lang.String name, java.lang.Object value)
name
- the name of the variable to setvalue
- the new value for the given variable
Groovy Documentation