org.codehaus.groovy.runtime
Class InvokerHelper

java.lang.Object
  |
  +--org.codehaus.groovy.runtime.InvokerHelper

public class InvokerHelper
extends Object

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

Version:
$Revision: 1.31 $
Author:
James Strachan

Field Summary
static Object[] EMPTY_ARGS
           
 
Constructor Summary
InvokerHelper()
           
 
Method Summary
static boolean asBool(Object object)
           
static Collection asCollection(Object collection)
           
static int asInt(Object value)
           
static Iterator asIterator(Object collection)
           
static List asList(Object args)
           
static void assertFailed(Object expression, Object message)
           
static boolean compareEqual(Object left, Object right)
           
static boolean compareGreaterThan(Object left, Object right)
           
static boolean compareGreaterThanEqual(Object left, Object right)
           
static boolean compareIdentical(Object left, Object right)
           
static boolean compareLessThan(Object left, Object right)
           
static boolean compareLessThanEqual(Object left, Object right)
           
static boolean compareNotEqual(Object left, Object right)
           
static List createList(Object[] values)
           
static Map createMap(Object[] values)
           
static List createRange(Object from, Object to)
           
static groovy.lang.Script createScript(Class scriptClass, groovy.lang.ScriptContext context)
           
static groovy.lang.Tuple createTuple(Object[] array)
           
static Matcher findRegex(Object left, Object right)
           
static org.codehaus.groovy.runtime.Invoker getInstance()
           
static groovy.lang.MetaClass getMetaClass(Object object)
           
static Object getProperty(Object object, String property)
           
static Object getPropertySafe(Object object, String property)
           
static String getVersion()
           
static Object invokeClosure(Object closure, Object arguments)
           
static Object invokeConstructor(String type, Object arguments)
           
static Object invokeConstructorOf(Class type, Object arguments)
           
static Object invokeMethod(Object object, String methodName, Object arguments)
           
static Object invokeMethodSafe(Object object, String methodName, Object arguments)
           
static Object invokeStaticMethod(String type, String methodName, Object arguments)
           
static Object invokeVoidMethod(Object object, String methodName)
           
static boolean isCase(Object switchValue, Object caseExpression)
           
static boolean matchRegex(Object left, Object right)
           
static boolean notBoolean(boolean bool)
           
static boolean notObject(Object object)
           
static Pattern regexPattern(String regex)
           
static Object runScript(Class scriptClass, String[] args)
           
static void setProperty(Object object, String property, Object newValue)
           
static void setProperty2(Object newValue, Object object, String property)
          This is so we don't have to reorder the stack when we call this method.
static void setPropertySafe2(Object newValue, Object object, String property)
          This is so we don't have to reorder the stack when we call this method.
static String toString(Object arguments)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_ARGS

public static final Object[] EMPTY_ARGS
Constructor Detail

InvokerHelper

public InvokerHelper()
Method Detail

getMetaClass

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

getInstance

public static org.codehaus.groovy.runtime.Invoker getInstance()

invokeVoidMethod

public static Object invokeVoidMethod(Object object,
                                      String methodName)

invokeMethod

public static Object invokeMethod(Object object,
                                  String methodName,
                                  Object arguments)

invokeMethodSafe

public static Object invokeMethodSafe(Object object,
                                      String methodName,
                                      Object arguments)

invokeStaticMethod

public static Object invokeStaticMethod(String type,
                                        String methodName,
                                        Object arguments)

invokeConstructor

public static Object invokeConstructor(String type,
                                       Object arguments)

invokeConstructorOf

public static Object invokeConstructorOf(Class type,
                                         Object arguments)

invokeClosure

public static Object invokeClosure(Object closure,
                                   Object arguments)

asIterator

public static Iterator asIterator(Object collection)

asCollection

public static Collection asCollection(Object collection)

asList

public static List asList(Object args)

toString

public static String toString(Object arguments)

getProperty

public static Object getProperty(Object object,
                                 String property)

getPropertySafe

public static Object getPropertySafe(Object object,
                                     String property)

setProperty

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

setProperty2

public static void setProperty2(Object newValue,
                                Object object,
                                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(Object newValue,
                                    Object object,
                                    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.


asBool

public static boolean asBool(Object object)

notObject

public static boolean notObject(Object object)

notBoolean

public static boolean notBoolean(boolean bool)

isCase

public static boolean isCase(Object switchValue,
                             Object caseExpression)

compareIdentical

public static boolean compareIdentical(Object left,
                                       Object right)

compareEqual

public static boolean compareEqual(Object left,
                                   Object right)

findRegex

public static Matcher findRegex(Object left,
                                Object right)

matchRegex

public static boolean matchRegex(Object left,
                                 Object right)

regexPattern

public static Pattern regexPattern(String regex)

compareNotEqual

public static boolean compareNotEqual(Object left,
                                      Object right)

compareLessThan

public static boolean compareLessThan(Object left,
                                      Object right)

compareLessThanEqual

public static boolean compareLessThanEqual(Object left,
                                           Object right)

compareGreaterThan

public static boolean compareGreaterThan(Object left,
                                         Object right)

compareGreaterThanEqual

public static boolean compareGreaterThanEqual(Object left,
                                              Object right)

createTuple

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

createList

public static List createList(Object[] values)

createMap

public static Map createMap(Object[] values)

createRange

public static List createRange(Object from,
                               Object to)

asInt

public static int asInt(Object value)

assertFailed

public static void assertFailed(Object expression,
                                Object message)

runScript

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

createScript

public static groovy.lang.Script createScript(Class scriptClass,
                                              groovy.lang.ScriptContext context)

getVersion

public static String getVersion()


Copyright © 2003 The Codehaus. All Rights Reserved.