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

## org.codehaus.groovy.runtime
[Java] Class InvokerHelper

    java.lang.Object
      org.codehaus.groovy.runtime.InvokerHelper

    public class InvokerHelper
    extends java.lang.Object

A static helper class to make bytecode generation easier and act as a facade over the Invoker

Authors:
  James Strachan

Version:
  \$Revision\$

Field Summary
`static java.lang.Object[]` | `EMPTY_ARGS`
`protected static java.lang.Object[]` | `EMPTY_ARGUMENTS`
`protected static java.lang.Class[]` | `EMPTY_TYPES`
`static MetaClassRegistry` | `metaRegistry`

Method Summary
`static void` | `append(java.lang.Appendable out, java.lang.Object object)` Appends an object to an Appendable using Groovy's default representation for the object.
`static java.lang.Object[]` | `asArray(java.lang.Object arguments)`
`static java.util.Iterator` | `asIterator(java.lang.Object o)`
`static java.util.List` | `asList(java.lang.Object value)`
`static java.lang.Object[]` | `asUnwrappedArray(java.lang.Object arguments)`
`static void` | `assertFailed(java.lang.Object expression, java.lang.Object message)`
`static java.lang.Object` | `bitwiseNegate(java.lang.Object value)`
`static java.util.List` | `createList(java.lang.Object[] values)`
`static java.util.Map` | `createMap(java.lang.Object[] values)`
`static java.util.List` | `createRange(java.lang.Object from, java.lang.Object to, boolean inclusive)`
`static Script` | `createScript(java.lang.Class scriptClass, Binding context)`
`static Tuple` | `createTuple(java.lang.Object[] array)`
`static java.util.regex.Matcher` | `findRegex(java.lang.Object left, java.lang.Object right)` Find the right hand regex within the left hand string and return a matcher.
`protected static java.lang.String` | `format(java.lang.Object arguments, boolean verbose)`
`static java.lang.String` | `format(java.lang.Object arguments, boolean verbose, int maxSize)`
`static java.lang.Object` | `getAttribute(java.lang.Object object, java.lang.String attribute)`
`static java.lang.Object` | `getGroovyObjectProperty(GroovyObject object, java.lang.String property)`
`static MetaClass` | `getMetaClass(java.lang.Object object)`
`static MetaClass` | `getMetaClass(java.lang.Class cls)`
`static MetaClassRegistry` | `getMetaRegistry()` Invokes the given method on the object.
`static Closure` | `getMethodPointer(java.lang.Object object, java.lang.String methodName)` Returns the method pointer for the given object name
`static java.lang.Object` | `getProperty(java.lang.Object object, java.lang.String property)`
`static java.lang.Object` | `getPropertySafe(java.lang.Object object, java.lang.String property)`
`static java.lang.String` | `inspect(java.lang.Object self)`
`static java.lang.Object` | `invokeClosure(java.lang.Object closure, java.lang.Object arguments)`
`static java.lang.Object` | `invokeConstructorOf(java.lang.String klass, java.lang.Object arguments)`
`static java.lang.Object` | `invokeConstructorOf(java.lang.Class type, java.lang.Object arguments)`
`static java.lang.Object` | `invokeMethod(java.lang.Object object, java.lang.String methodName, java.lang.Object arguments)`
`static java.lang.Object` | `invokeMethodSafe(java.lang.Object object, java.lang.String methodName, java.lang.Object arguments)`
`static java.lang.Object` | `invokeNoArgumentsConstructorOf(java.lang.Class type)`
`static java.lang.Object` | `invokeStaticMethod(java.lang.String klass, java.lang.String methodName, java.lang.Object arguments)`
`static java.lang.Object` | `invokeStaticMethod(java.lang.Class type, java.lang.String method, java.lang.Object arguments)`
`static java.lang.Object` | `invokeStaticNoArgumentsMethod(java.lang.Class type, java.lang.String methodName)`
`static java.lang.Object` | `invokeSuperMethod(java.lang.Object object, java.lang.String methodName, java.lang.Object arguments)` Converts the given object into an array; if its an array then just cast otherwise wrap it in an array
`static boolean` | `matchRegex(java.lang.Object left, java.lang.Object right)` Find the right hand regex within the left hand string and return a matcher.
`static void` | `removeClass(java.lang.Class clazz)`
`static java.lang.Object` | `runScript(java.lang.Class scriptClass, java.lang.String[] args)`
`static void` | `setAttribute(java.lang.Object object, java.lang.String attribute, java.lang.Object newValue)`
`static void` | `setGroovyObjectProperty(java.lang.Object newValue, GroovyObject object, java.lang.String property)` This is so we don't have to reorder the stack when we call this method.
`static void` | `setProperties(java.lang.Object object, java.util.Map map)` Sets the properties on the given object
`static void` | `setProperty(java.lang.Object object, java.lang.String property, java.lang.Object newValue)`
`static void` | `setProperty2(java.lang.Object newValue, java.lang.Object object, java.lang.String property)` This is so we don't have to reorder the stack when we call this method.
`static void` | `setPropertySafe2(java.lang.Object newValue, java.lang.Object object, java.lang.String property)` This is so we don't have to reorder the stack when we call this method.
`static SpreadMap` | `spreadMap(java.lang.Object value)`
`static java.lang.String` | `toArrayString(java.lang.Object[] arguments)`
`static java.lang.String` | `toListString(java.util.Collection arg)`
`static java.lang.String` | `toListString(java.util.Collection arg, int maxSize)`
`static java.lang.String` | `toMapString(java.util.Map arg)` A helper method to return the string representation of a map with bracket boundaries "[" and "]".
`static java.lang.String` | `toMapString(java.util.Map arg, int maxSize)`
`static java.lang.String` | `toString(java.lang.Object arguments)`
`static java.lang.String` | `toTypeString(java.lang.Object[] arguments)` A helper method to format the arguments types as a comma-separated list.
`static java.lang.Object` | `unaryMinus(java.lang.Object value)`
`static java.lang.Object` | `unaryPlus(java.lang.Object value)`
`static void` | `write(java.io.Writer out, java.lang.Object object)` Writes an object to a Writer using Groovy's default representation for the object.

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

Field Detail

### EMPTY_ARGS

    public static final java.lang.Object[] EMPTY_ARGS

### EMPTY_ARGUMENTS

    protected static final java.lang.Object[] EMPTY_ARGUMENTS

### EMPTY_TYPES

    protected static final java.lang.Class[] EMPTY_TYPES

### metaRegistry

    public static final MetaClassRegistry metaRegistry

Method Detail

### append

    public static void append(java.lang.Appendable out, java.lang.Object object)

  Appends an object to an Appendable using Groovy's default representation for the object.

### asArray

    public static java.lang.Object[] asArray(java.lang.Object arguments)

### asIterator

    if (arguments == null) {
    public static java.util.Iterator asIterator(java.lang.Object o)

### asList

    public static java.util.List asList(java.lang.Object value)

### asUnwrappedArray

    public static java.lang.Object[] asUnwrappedArray(java.lang.Object arguments)

### assertFailed

    public static void assertFailed(java.lang.Object expression, java.lang.Object message)

### bitwiseNegate

    public static java.lang.Object bitwiseNegate(java.lang.Object value)

### createList

    public static java.util.List createList(java.lang.Object[] values)

### createMap

    public static java.util.Map createMap(java.lang.Object[] values)

### createRange

    public static java.util.List createRange(java.lang.Object from, java.lang.Object to, boolean inclusive)

### createScript

    public static Script createScript(java.lang.Class scriptClass, Binding context)

### createTuple

    public static Tuple createTuple(java.lang.Object[] array)

### findRegex

    public static java.util.regex.Matcher findRegex(java.lang.Object left, java.lang.Object right)

  Find the right hand regex within the left hand string and return a matcher.
  Parameters:
    `left` - string to compare
    `right` - regular expression to compare the string to

### format

    protected static java.lang.String format(java.lang.Object arguments, boolean verbose)

### format

    public static java.lang.String format(java.lang.Object arguments, boolean verbose, int maxSize)

### getAttribute

    public static java.lang.Object getAttribute(java.lang.Object object, java.lang.String attribute)

### getGroovyObjectProperty

    public static java.lang.Object getGroovyObjectProperty(GroovyObject object, java.lang.String property)

### getMetaClass

    public static MetaClass getMetaClass(java.lang.Object object)

### getMetaClass

    public static MetaClass getMetaClass(java.lang.Class cls)

### getMetaRegistry

    public static MetaClassRegistry getMetaRegistry()

  Invokes the given method on the object.

### getMethodPointer

    public static Closure getMethodPointer(java.lang.Object object, java.lang.String methodName)

  Returns the method pointer for the given object name

### getProperty

    public static java.lang.Object getProperty(java.lang.Object object, java.lang.String property)

### getPropertySafe

    public static java.lang.Object getPropertySafe(java.lang.Object object, java.lang.String property)

### inspect

    public static java.lang.String inspect(java.lang.Object self)

### invokeClosure

    public static java.lang.Object invokeClosure(java.lang.Object closure, java.lang.Object arguments)

### invokeConstructorOf

    public static java.lang.Object invokeConstructorOf(java.lang.String klass, java.lang.Object arguments)

### invokeConstructorOf

    public static java.lang.Object invokeConstructorOf(java.lang.Class type, java.lang.Object arguments)

### invokeMethod

    public static java.lang.Object invokeMethod(java.lang.Object object, java.lang.String methodName, java.lang.Object arguments)

### invokeMethodSafe

    public static java.lang.Object invokeMethodSafe(java.lang.Object object, java.lang.String methodName, java.lang.Object arguments)

### invokeNoArgumentsConstructorOf

    public static java.lang.Object invokeNoArgumentsConstructorOf(java.lang.Class type)

### invokeStaticMethod

    public static java.lang.Object invokeStaticMethod(java.lang.String klass, java.lang.String methodName, java.lang.Object arguments)

### invokeStaticMethod

    public static java.lang.Object invokeStaticMethod(java.lang.Class type, java.lang.String method, java.lang.Object arguments)

### invokeStaticNoArgumentsMethod

    public static java.lang.Object invokeStaticNoArgumentsMethod(java.lang.Class type, java.lang.String methodName)

### invokeSuperMethod

    public static java.lang.Object invokeSuperMethod(java.lang.Object object, java.lang.String methodName, java.lang.Object arguments)

  Converts the given object into an array; if its an array then just cast otherwise wrap it in an array

### matchRegex

    public static boolean matchRegex(java.lang.Object left, java.lang.Object right)

  Find the right hand regex within the left hand string and return a matcher.
  Parameters:
    `left` - string to compare
    `right` - regular expression to compare the string to

### removeClass

    public static void removeClass(java.lang.Class clazz)

### runScript

    public static java.lang.Object runScript(java.lang.Class scriptClass, java.lang.String[] args)

### setAttribute

    public static void setAttribute(java.lang.Object object, java.lang.String attribute, java.lang.Object newValue)

### setGroovyObjectProperty

    public static void setGroovyObjectProperty(java.lang.Object newValue, GroovyObject object, java.lang.String property)

  This is so we don't have to reorder the stack when we call this method. At some point a better name might be in order.

### setProperties

    public static void setProperties(java.lang.Object object, java.util.Map map)

  Sets the properties on the given object

### setProperty

    public static void setProperty(java.lang.Object object, java.lang.String property, java.lang.Object newValue)

### setProperty2

    public static void setProperty2(java.lang.Object newValue, java.lang.Object object, java.lang.String property)

  This is so we don't have to reorder the stack when we call this method. At some point a better name might be in order.

### setPropertySafe2

    public static void setPropertySafe2(java.lang.Object newValue, java.lang.Object object, java.lang.String property)

  This is so we don't have to reorder the stack when we call this method. At some point a better name might be in order.

### spreadMap

    public static SpreadMap spreadMap(java.lang.Object value)

### toArrayString

    public static java.lang.String toArrayString(java.lang.Object[] arguments)

### toListString

    public static java.lang.String toListString(java.util.Collection arg)

### toListString

    public static java.lang.String toListString(java.util.Collection arg, int maxSize)

### toMapString

    public static java.lang.String toMapString(java.util.Map arg)

  A helper method to return the string representation of a map with bracket boundaries "[" and "]".
  Parameters:
    `arg` - the map to process
    `maxSize` - stop after approximately this many characters and append '...'
  Returns:
    the string representation of the map

### toMapString

    public static java.lang.String toMapString(java.util.Map arg, int maxSize)

### toString

    public static java.lang.String toString(java.lang.Object arguments)

### toTypeString

    public static java.lang.String toTypeString(java.lang.Object[] arguments)

  A helper method to format the arguments types as a comma-separated list.
  Parameters:
    `arguments` - the type to process
  Returns:
    the string representation of the type

### unaryMinus

    public static java.lang.Object unaryMinus(java.lang.Object value)

### unaryPlus

    public static java.lang.Object unaryPlus(java.lang.Object value)

### write

    public static void write(java.io.Writer out, java.lang.Object object)

  Writes an object to a Writer using Groovy's default representation for the object.

Groovy Documentation