|
Groovy 2.2.0 | |||||||
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(Map variables)
|
|
Binding(String[] args)
A helper constructor used in main(String[]) method calls |
Method Summary | |
---|---|
Object
|
getProperty(String property)
Overloaded to make variables appear as bean properties or via the subscript operator |
Object
|
getVariable(String name)
@param name the name of the variable to lookup |
Map
|
getVariables()
|
boolean
|
hasVariable(String name)
Simple check for whether the binding contains a particular variable or not. |
void
|
setProperty(String property, Object newValue)
@todo we should check if we have the property with the metaClass instead of try/catch |
void
|
setVariable(String name, Object value)
Sets the value of the given variable |
Methods inherited from class GroovyObjectSupport | |
---|---|
getMetaClass, getProperty, invokeMethod, setMetaClass, setProperty |
Methods inherited from class Object | |
---|---|
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Constructor Detail |
---|
public Binding()
public Binding(Map variables)
public Binding(String[] args)
args
- are the command line arguments from a main()
Method Detail |
---|
public Object getProperty(String property)
public Object getVariable(String name)
name
- the name of the variable to lookup
public Map getVariables()
public boolean hasVariable(String name)
name
- the name of the variable to check for
public void setProperty(String property, Object newValue)
public void setVariable(String name, Object value)
name
- the name of the variable to setvalue
- the new value for the given variable
Copyright © 2003-2013 The Codehaus. All rights reserved.