Overview | Package | Class | Deprecated | Index | Help
| Groovy 1.7.6
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## groovy.lang
[Java] Class Binding

    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.

Authors:
  James Strachan

Version:
  \$Revision: 14400 \$

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()`
`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

### Binding

    public Binding()

### Binding

    public Binding(Map variables)

### Binding

    public Binding(String[] args)

  A helper constructor used in main(String[]) method calls
  Parameters:
    `args` - are the command line arguments from a main()

Method Detail

### getProperty

    public Object getProperty(String property)

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

### getVariable

    public Object getVariable(String name)

  Parameters:
    `name` - the name of the variable to lookup
  Returns:
    the variable value

### getVariables

    public Map getVariables()

### setProperty

    public void setProperty(String property, Object newValue)

  todo:
    we should check if we have the property with the metaClass instead of try/catch

### setVariable

    public void setVariable(String name, Object value)

  Sets the value of the given variable
  Parameters:
    `name` - the name of the variable to set
    `value` - the new value for the given variable

Copyright © 2003-2010 The Codehaus. All rights reserved.