Package org.codehaus.groovy.runtime
Class ScriptBytecodeAdapter
java.lang.Object
org.codehaus.groovy.runtime.ScriptBytecodeAdapter
A static helper class to interface bytecode and runtime
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
assertFailed
(Object expression, Object message) static Object
Provides a hook for type coercion of the given object to the required typestatic Object
bitwiseNegate
(Object value) static Object
castToType
(Object object, Class type) Provides a hook for type casting of the given object to the required typestatic 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 boolean
compareNotIdentical
(Object left, Object right) static Integer
static Wrapper
createGroovyObjectWrapper
(GroovyObject val, Class clazz) static List
createList
(Object[] values) static Map
static Wrapper
createPojoWrapper
(Object val, Class clazz) static List
createRange
(Object from, Object to, boolean inclusive) static List
createRange
(Object from, Object to, boolean exclusiveLeft, boolean exclusiveRight) static Tuple
createTuple
(Object[] array) static Object[]
despreadList
(Object[] args, Object[] spreads, int[] positions) static Matcher
static Object
static Object
getFieldOnSuper
(Class senderClass, Object receiver, String messageName) static Object
getFieldOnSuperSafe
(Class senderClass, Object receiver, String messageName) static Object
getFieldOnSuperSpreadSafe
(Class senderClass, Object receiver, String messageName) static Object
getFieldSafe
(Class senderClass, Object receiver, String messageName) static Object
getFieldSpreadSafe
(Class senderClass, Object receiver, String messageName) static Object
getGroovyObjectField
(Class senderClass, GroovyObject receiver, String messageName) static Object
getGroovyObjectFieldSafe
(Class senderClass, GroovyObject receiver, String messageName) static Object
getGroovyObjectFieldSpreadSafe
(Class senderClass, GroovyObject receiver, String messageName) static Object
getGroovyObjectProperty
(Class senderClass, GroovyObject receiver, String messageName) static Object
getGroovyObjectPropertySafe
(Class senderClass, GroovyObject receiver, String messageName) static Object
getGroovyObjectPropertySpreadSafe
(Class senderClass, GroovyObject receiver, String messageName) static Closure
getMethodPointer
(Object object, String methodName) Returns the method pointer for the given object namestatic Object
getProperty
(Class senderClass, Object receiver, String messageName) static Object
getPropertyOnSuper
(Class senderClass, GroovyObject receiver, String messageName) static Object
getPropertyOnSuperSafe
(Class senderClass, GroovyObject receiver, String messageName) static Object
getPropertyOnSuperSpreadSafe
(Class senderClass, GroovyObject receiver, String messageName) static Object
getPropertySafe
(Class senderClass, Object receiver, String messageName) static Object
getPropertySpreadSafe
(Class senderClass, Object receiver, String messageName) static MetaClass
initMetaClass
(Object object) static Object
invokeClosure
(Object closure, Object[] arguments) static Object
invokeMethod0
(Class senderClass, Object receiver, String messageName) static Object
invokeMethod0Safe
(Class senderClass, Object receiver, String messageName) static Object
invokeMethod0SpreadSafe
(Class senderClass, Object receiver, String messageName) static Object
invokeMethodN
(Class senderClass, Object receiver, String messageName, Object[] messageArguments) static Object
invokeMethodNSafe
(Class senderClass, Object receiver, String messageName, Object[] messageArguments) static Object
invokeMethodNSpreadSafe
(Class senderClass, Object receiver, String messageName, Object[] messageArguments) static Object
invokeMethodOnCurrent0
(Class senderClass, GroovyObject receiver, String messageName) static Object
invokeMethodOnCurrent0Safe
(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) static Object
invokeMethodOnCurrent0SpreadSafe
(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) static Object
invokeMethodOnCurrentN
(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) static Object
invokeMethodOnCurrentNSafe
(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) static Object
invokeMethodOnCurrentNSpreadSafe
(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) static Object
invokeMethodOnSuper0
(Class senderClass, GroovyObject receiver, String messageName) static Object
invokeMethodOnSuper0Safe
(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) static Object
invokeMethodOnSuper0SpreadSafe
(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) static Object
invokeMethodOnSuperN
(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) static Object
invokeMethodOnSuperNSafe
(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) static Object
invokeMethodOnSuperNSpreadSafe
(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) static Object
invokeNew0
(Class senderClass, Class receiver) static Object
invokeNewN
(Class senderClass, Class receiver, Object arguments) static Object
invokeStaticMethod0
(Class senderClass, Class receiver, String messageName) static Object
invokeStaticMethodN
(Class senderClass, Class receiver, String messageName, Object[] messageArguments) static boolean
static boolean
static boolean
matchRegex
(Object left, Object right) static Pattern
regexPattern
(Object regex) static int
selectConstructorAndTransformArguments
(Object[] arguments, int numberOfConstructors, Class which) static void
static void
setFieldOnSuper
(Object messageArgument, Class senderClass, Object receiver, String messageName) static void
setFieldOnSuperSafe
(Object messageArgument, Class senderClass, Object receiver, String messageName) static void
setFieldOnSuperSpreadSafe
(Object messageArgument, Class senderClass, Object receiver, String messageName) static void
setFieldSafe
(Object messageArgument, Class senderClass, Object receiver, String messageName) static void
setFieldSpreadSafe
(Object messageArgument, Class senderClass, Object receiver, String messageName) static void
setGroovyObjectField
(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) static void
setGroovyObjectFieldSafe
(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) static void
setGroovyObjectFieldSpreadSafe
(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) static void
setGroovyObjectProperty
(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) static void
setGroovyObjectPropertySafe
(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) static void
setGroovyObjectPropertySpreadSafe
(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) static void
setProperty
(Object messageArgument, Class senderClass, Object receiver, String messageName) static void
setPropertyOnSuper
(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) static void
setPropertyOnSuperSafe
(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) static void
setPropertyOnSuperSpreadSafe
(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) static void
setPropertySafe
(Object messageArgument, Class senderClass, Object receiver, String messageName) static void
setPropertySpreadSafe
(Object messageArgument, Class senderClass, Object receiver, String messageName) static Object
static Object
unaryMinus
(Object value) static Object
static Throwable
-
Field Details
-
EMPTY_ARGS
-
-
Constructor Details
-
ScriptBytecodeAdapter
public ScriptBytecodeAdapter()
-
-
Method Details
-
unwrap
-
invokeMethodOnCurrentN
public static Object invokeMethodOnCurrentN(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) throws Throwable - Throws:
Throwable
-
invokeMethodOnCurrentNSafe
public static Object invokeMethodOnCurrentNSafe(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) throws Throwable - Throws:
Throwable
-
invokeMethodOnCurrentNSpreadSafe
public static Object invokeMethodOnCurrentNSpreadSafe(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) throws Throwable - Throws:
Throwable
-
invokeMethodOnCurrent0
public static Object invokeMethodOnCurrent0(Class senderClass, GroovyObject receiver, String messageName) throws Throwable - Throws:
Throwable
-
invokeMethodOnCurrent0Safe
public static Object invokeMethodOnCurrent0Safe(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) throws Throwable - Throws:
Throwable
-
invokeMethodOnCurrent0SpreadSafe
public static Object invokeMethodOnCurrent0SpreadSafe(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) throws Throwable - Throws:
Throwable
-
invokeMethodOnSuperN
public static Object invokeMethodOnSuperN(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) throws Throwable - Throws:
Throwable
-
invokeMethodOnSuperNSafe
public static Object invokeMethodOnSuperNSafe(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) throws Throwable - Throws:
Throwable
-
invokeMethodOnSuperNSpreadSafe
public static Object invokeMethodOnSuperNSpreadSafe(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) throws Throwable - Throws:
Throwable
-
invokeMethodOnSuper0
public static Object invokeMethodOnSuper0(Class senderClass, GroovyObject receiver, String messageName) throws Throwable - Throws:
Throwable
-
invokeMethodOnSuper0Safe
public static Object invokeMethodOnSuper0Safe(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) throws Throwable - Throws:
Throwable
-
invokeMethodOnSuper0SpreadSafe
public static Object invokeMethodOnSuper0SpreadSafe(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) throws Throwable - Throws:
Throwable
-
invokeMethodN
public static Object invokeMethodN(Class senderClass, Object receiver, String messageName, Object[] messageArguments) throws Throwable - Throws:
Throwable
-
invokeMethodNSafe
public static Object invokeMethodNSafe(Class senderClass, Object receiver, String messageName, Object[] messageArguments) throws Throwable - Throws:
Throwable
-
invokeMethodNSpreadSafe
public static Object invokeMethodNSpreadSafe(Class senderClass, Object receiver, String messageName, Object[] messageArguments) throws Throwable - Throws:
Throwable
-
invokeMethod0
public static Object invokeMethod0(Class senderClass, Object receiver, String messageName) throws Throwable - Throws:
Throwable
-
invokeMethod0Safe
public static Object invokeMethod0Safe(Class senderClass, Object receiver, String messageName) throws Throwable - Throws:
Throwable
-
invokeMethod0SpreadSafe
public static Object invokeMethod0SpreadSafe(Class senderClass, Object receiver, String messageName) throws Throwable - Throws:
Throwable
-
invokeStaticMethodN
public static Object invokeStaticMethodN(Class senderClass, Class receiver, String messageName, Object[] messageArguments) throws Throwable - Throws:
Throwable
-
invokeStaticMethod0
public static Object invokeStaticMethod0(Class senderClass, Class receiver, String messageName) throws Throwable - Throws:
Throwable
-
invokeNewN
public static Object invokeNewN(Class senderClass, Class receiver, Object arguments) throws Throwable - Throws:
Throwable
-
invokeNew0
- Throws:
Throwable
-
selectConstructorAndTransformArguments
public static int selectConstructorAndTransformArguments(Object[] arguments, int numberOfConstructors, Class which) throws Throwable - Throws:
Throwable
-
getFieldOnSuper
public static Object getFieldOnSuper(Class senderClass, Object receiver, String messageName) throws Throwable - Throws:
Throwable
-
getFieldOnSuperSafe
public static Object getFieldOnSuperSafe(Class senderClass, Object receiver, String messageName) throws Throwable - Throws:
Throwable
-
getFieldOnSuperSpreadSafe
public static Object getFieldOnSuperSpreadSafe(Class senderClass, Object receiver, String messageName) throws Throwable - Throws:
Throwable
-
setFieldOnSuper
public static void setFieldOnSuper(Object messageArgument, Class senderClass, Object receiver, String messageName) throws Throwable - Throws:
Throwable
-
setFieldOnSuperSafe
public static void setFieldOnSuperSafe(Object messageArgument, Class senderClass, Object receiver, String messageName) throws Throwable - Throws:
Throwable
-
setFieldOnSuperSpreadSafe
public static void setFieldOnSuperSpreadSafe(Object messageArgument, Class senderClass, Object receiver, String messageName) throws Throwable - Throws:
Throwable
-
getField
public static Object getField(Class senderClass, Object receiver, String messageName) throws Throwable - Throws:
Throwable
-
getFieldSafe
public static Object getFieldSafe(Class senderClass, Object receiver, String messageName) throws Throwable - Throws:
Throwable
-
getFieldSpreadSafe
public static Object getFieldSpreadSafe(Class senderClass, Object receiver, String messageName) throws Throwable - Throws:
Throwable
-
setField
public static void setField(Object messageArgument, Class senderClass, Object receiver, String messageName) throws Throwable - Throws:
Throwable
-
setFieldSafe
public static void setFieldSafe(Object messageArgument, Class senderClass, Object receiver, String messageName) throws Throwable - Throws:
Throwable
-
setFieldSpreadSafe
public static void setFieldSpreadSafe(Object messageArgument, Class senderClass, Object receiver, String messageName) throws Throwable - Throws:
Throwable
-
getGroovyObjectField
public static Object getGroovyObjectField(Class senderClass, GroovyObject receiver, String messageName) throws Throwable - Throws:
Throwable
-
getGroovyObjectFieldSafe
public static Object getGroovyObjectFieldSafe(Class senderClass, GroovyObject receiver, String messageName) throws Throwable - Throws:
Throwable
-
getGroovyObjectFieldSpreadSafe
public static Object getGroovyObjectFieldSpreadSafe(Class senderClass, GroovyObject receiver, String messageName) throws Throwable - Throws:
Throwable
-
setGroovyObjectField
public static void setGroovyObjectField(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) throws Throwable - Throws:
Throwable
-
setGroovyObjectFieldSafe
public static void setGroovyObjectFieldSafe(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) throws Throwable - Throws:
Throwable
-
setGroovyObjectFieldSpreadSafe
public static void setGroovyObjectFieldSpreadSafe(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) throws Throwable - Throws:
Throwable
-
getPropertyOnSuper
public static Object getPropertyOnSuper(Class senderClass, GroovyObject receiver, String messageName) throws Throwable - Throws:
Throwable
-
getPropertyOnSuperSafe
public static Object getPropertyOnSuperSafe(Class senderClass, GroovyObject receiver, String messageName) throws Throwable - Throws:
Throwable
-
getPropertyOnSuperSpreadSafe
public static Object getPropertyOnSuperSpreadSafe(Class senderClass, GroovyObject receiver, String messageName) throws Throwable - Throws:
Throwable
-
setPropertyOnSuper
public static void setPropertyOnSuper(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) throws Throwable - Throws:
Throwable
-
setPropertyOnSuperSafe
public static void setPropertyOnSuperSafe(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) throws Throwable - Throws:
Throwable
-
setPropertyOnSuperSpreadSafe
public static void setPropertyOnSuperSpreadSafe(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) throws Throwable - Throws:
Throwable
-
getProperty
public static Object getProperty(Class senderClass, Object receiver, String messageName) throws Throwable - Throws:
Throwable
-
getPropertySafe
public static Object getPropertySafe(Class senderClass, Object receiver, String messageName) throws Throwable - Throws:
Throwable
-
getPropertySpreadSafe
public static Object getPropertySpreadSafe(Class senderClass, Object receiver, String messageName) throws Throwable - Throws:
Throwable
-
setProperty
public static void setProperty(Object messageArgument, Class senderClass, Object receiver, String messageName) throws Throwable - Throws:
Throwable
-
setPropertySafe
public static void setPropertySafe(Object messageArgument, Class senderClass, Object receiver, String messageName) throws Throwable - Throws:
Throwable
-
setPropertySpreadSafe
public static void setPropertySpreadSafe(Object messageArgument, Class senderClass, Object receiver, String messageName) throws Throwable - Throws:
Throwable
-
getGroovyObjectProperty
public static Object getGroovyObjectProperty(Class senderClass, GroovyObject receiver, String messageName) throws Throwable - Throws:
Throwable
-
getGroovyObjectPropertySafe
public static Object getGroovyObjectPropertySafe(Class senderClass, GroovyObject receiver, String messageName) throws Throwable - Throws:
Throwable
-
getGroovyObjectPropertySpreadSafe
public static Object getGroovyObjectPropertySpreadSafe(Class senderClass, GroovyObject receiver, String messageName) throws Throwable - Throws:
Throwable
-
setGroovyObjectProperty
public static void setGroovyObjectProperty(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) throws Throwable - Throws:
Throwable
-
setGroovyObjectPropertySafe
public static void setGroovyObjectPropertySafe(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) throws Throwable - Throws:
Throwable
-
setGroovyObjectPropertySpreadSafe
public static void setGroovyObjectPropertySpreadSafe(Object messageArgument, Class senderClass, GroovyObject receiver, String messageName) throws Throwable - Throws:
Throwable
-
getMethodPointer
Returns the method pointer for the given object name- Parameters:
object
- the object containing the methodmethodName
- the name of the method of interest- Returns:
- the resulting Closure
-
invokeClosure
- Throws:
Throwable
-
asType
Provides a hook for type coercion of the given object to the required type- Parameters:
type
- of object to convert the given object toobject
- the object to be converted- Returns:
- the original object or a new converted value
- Throws:
Throwable
- if the coercion fails
-
castToType
Provides a hook for type casting of the given object to the required type- Parameters:
type
- of object to convert the given object toobject
- the object to be converted- Returns:
- the original object or a new converted value
- Throws:
Throwable
- if the type casting fails
-
createTuple
-
createList
-
createPojoWrapper
-
createGroovyObjectWrapper
-
createMap
-
createRange
public static List createRange(Object from, Object to, boolean exclusiveLeft, boolean exclusiveRight) throws Throwable - Throws:
Throwable
-
createRange
- Throws:
Throwable
-
assertFailed
-
isCase
- Throws:
Throwable
-
isNotCase
- Throws:
Throwable
-
compareIdentical
-
compareNotIdentical
-
compareEqual
-
compareNotEqual
-
compareTo
-
compareLessThan
-
compareLessThanEqual
-
compareGreaterThan
-
compareGreaterThanEqual
-
regexPattern
-
findRegex
- Throws:
Throwable
-
matchRegex
-
despreadList
-
spreadMap
-
unaryMinus
- Throws:
Throwable
-
unaryPlus
- Throws:
Throwable
-
bitwiseNegate
- Throws:
Throwable
-
initMetaClass
-