org.spockframework.util
Class GroovyRuntimeUtil

java.lang.Object
  extended by org.spockframework.util.GroovyRuntimeUtil

public abstract class GroovyRuntimeUtil
extends java.lang.Object

Provides convenient access to Groovy language and runtime features. By convention, all usages of Groovy's InvokerHelper and ScriptBytecodeAdapter go through this class.

Author:
Peter Niederwieser

Constructor Summary
GroovyRuntimeUtil()
           
 
Method Summary
static java.lang.Object[] asArray(java.lang.Object args)
           
static java.util.Iterator<java.lang.Object> asIterator(java.lang.Object object)
          Note: This method may throw checked exceptions although it doesn't say so.
static java.lang.Object coerce(java.lang.Object obj, java.lang.Class<?> type)
           
static java.lang.Object[] despreadList(java.lang.Object[] args, java.lang.Object[] spreads, int[] positions)
           
static boolean equals(java.lang.Object obj, java.lang.Object other)
           
static java.lang.Object getAttribute(java.lang.Object target, java.lang.String name)
          Note: This method may throw checked exceptions although it doesn't say so.
static groovy.lang.MetaClass getMetaClass(java.lang.Object object)
           
static java.lang.Object getProperty(java.lang.Object target, java.lang.String property)
          Note: This method may throw checked exceptions although it doesn't say so.
static java.lang.Object invokeClosure(groovy.lang.Closure closure, java.lang.Object... args)
          Note: This method may throw checked exceptions although it doesn't say so.
static java.lang.Object invokeConstructor(java.lang.Class<?> clazz, java.lang.Object... args)
          Note: This method may throw checked exceptions although it doesn't say so.
static java.lang.Object invokeMethod(java.lang.Object target, java.lang.String method, java.lang.Object... args)
          Note: This method may throw checked exceptions although it doesn't say so.
static java.lang.Object invokeMethodNullSafe(java.lang.Object target, java.lang.String method, java.lang.Object... args)
           
static java.lang.Object invokeMethodQuietly(java.lang.Object target, java.lang.String method, java.lang.Object... args)
           
static boolean isTruthy(java.lang.Object obj)
           
static boolean isVoidMethod(java.lang.Object target, java.lang.String method, java.lang.Object... args)
           
static java.lang.String propertyToMethodName(java.lang.String prefix, java.lang.String propertyName)
           
static void setProperty(java.lang.Object target, java.lang.String property, java.lang.Object value)
          Note: This method may throw checked exceptions although it doesn't say so.
static java.lang.String toString(java.lang.Object obj)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroovyRuntimeUtil

public GroovyRuntimeUtil()
Method Detail

isTruthy

public static boolean isTruthy(java.lang.Object obj)

coerce

public static java.lang.Object coerce(java.lang.Object obj,
                                      java.lang.Class<?> type)

equals

public static boolean equals(java.lang.Object obj,
                             java.lang.Object other)

toString

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

getMetaClass

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

propertyToMethodName

public static java.lang.String propertyToMethodName(java.lang.String prefix,
                                                    java.lang.String propertyName)

getProperty

public static java.lang.Object getProperty(java.lang.Object target,
                                           java.lang.String property)
Note: This method may throw checked exceptions although it doesn't say so.


setProperty

public static void setProperty(java.lang.Object target,
                               java.lang.String property,
                               java.lang.Object value)
Note: This method may throw checked exceptions although it doesn't say so.


invokeConstructor

public static java.lang.Object invokeConstructor(java.lang.Class<?> clazz,
                                                 java.lang.Object... args)
Note: This method may throw checked exceptions although it doesn't say so.


invokeMethod

public static java.lang.Object invokeMethod(java.lang.Object target,
                                            java.lang.String method,
                                            java.lang.Object... args)
Note: This method may throw checked exceptions although it doesn't say so.


invokeMethodNullSafe

public static java.lang.Object invokeMethodNullSafe(java.lang.Object target,
                                                    java.lang.String method,
                                                    java.lang.Object... args)

invokeMethodQuietly

public static java.lang.Object invokeMethodQuietly(java.lang.Object target,
                                                   java.lang.String method,
                                                   java.lang.Object... args)

invokeClosure

public static java.lang.Object invokeClosure(groovy.lang.Closure closure,
                                             java.lang.Object... args)
Note: This method may throw checked exceptions although it doesn't say so.


asIterator

public static java.util.Iterator<java.lang.Object> asIterator(java.lang.Object object)
Note: This method may throw checked exceptions although it doesn't say so.


asArray

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

despreadList

public static java.lang.Object[] despreadList(java.lang.Object[] args,
                                              java.lang.Object[] spreads,
                                              int[] positions)

isVoidMethod

public static boolean isVoidMethod(java.lang.Object target,
                                   java.lang.String method,
                                   java.lang.Object... args)

getAttribute

public static java.lang.Object getAttribute(java.lang.Object target,
                                            java.lang.String name)
Note: This method may throw checked exceptions although it doesn't say so.



Copyright © 2013. All rights reserved