|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.groovy.runtime.ScriptBytecodeAdapter
public class ScriptBytecodeAdapter
A static helper class to make bytecode generation easier and act as a facade over the Invoker.
Field Summary | |
---|---|
static Object[] |
EMPTY_ARGS
|
Constructor Summary | |
---|---|
ScriptBytecodeAdapter()
|
Method Summary | |
---|---|
static boolean |
asBool(Object object)
|
static int |
asInt(Object value)
|
static Iterator |
asIterator(Object collection)
|
static void |
assertFailed(Object expression,
Object message)
|
static Object |
asType(Object object,
Class type)
Provides a hook for type coercion of the given object to the required type |
static Object |
bitNegate(Object value)
|
static boolean |
booleanUnbox(Object value)
|
static Object |
box(boolean value)
|
static Object |
box(byte value)
|
static Object |
box(char value)
|
static Object |
box(double value)
|
static Object |
box(float value)
|
static Object |
box(int value)
|
static Object |
box(long value)
|
static Object |
box(short value)
|
static byte |
byteUnbox(Object value)
|
static char |
charUnbox(Object value)
|
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 Integer |
compareTo(Object left,
Object right)
|
static Object[] |
convertPrimitiveArray(Object a,
Class type)
|
static Object |
convertToPrimitiveArray(Object a,
Class type)
|
static List |
createList(Object[] values)
|
static Map |
createMap(Object[] values)
|
static List |
createRange(Object from,
Object to,
boolean inclusive)
|
static Tuple |
createTuple(Object[] array)
|
static double |
doubleUnbox(Object value)
|
static Matcher |
findRegex(Object left,
Object right)
|
static float |
floatUnbox(Object value)
|
static Object |
getAttribute(Object object,
String attribute)
|
static Object |
getAttributeSafe(Object object,
String attribute)
|
static Object |
getAttributeSpreadSafe(Object object,
String attribute)
|
static Object |
getGroovyObjectProperty(GroovyObject object,
String property)
|
static MetaClass |
getMetaClass(Object object)
|
static Closure |
getMethodPointer(Object object,
String methodName)
Returns the method pointer for the given object name |
static Object |
getProperty(Object object,
String property)
|
static Object |
getPropertySafe(Object object,
String property)
|
static Object |
getPropertySpreadSafe(Object object,
String property)
|
static Integer |
integerValue(int v)
get the Integer object from an int. |
static int |
intUnbox(Object value)
|
static Object |
invokeClosure(Object closure,
Object arguments)
|
static Object |
invokeConstructorAt(Class at,
Class 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 |
invokeMethodSpreadSafe(Object object,
String methodName,
Object arguments)
|
static Object |
invokeNoArgumentsConstructorAt(Class at,
Class type)
|
static Object |
invokeNoArgumentsConstructorOf(Class type)
|
static Object |
invokeNoArgumentsMethod(Object object,
String methodName)
|
static Object |
invokeNoArgumentsMethodSafe(Object object,
String methodName)
|
static Object |
invokeNoArgumentsMethodSpreadSafe(Object object,
String methodName)
|
static Object |
invokeStaticMethod(String type,
String methodName,
Object arguments)
|
static Object |
invokeStaticNoArgumentsMethod(String type,
String methodName)
|
static Object |
invokeSuperMethod(Object object,
String methodName,
Object arguments)
|
static boolean |
isCase(Object switchValue,
Object caseExpression)
|
static long |
longUnbox(Object value)
|
static boolean |
matchRegex(Object left,
Object right)
|
static Object |
negate(Object value)
|
static boolean |
notBoolean(boolean bool)
|
static boolean |
notObject(Object object)
|
static Pattern |
regexPattern(Object regex)
|
static void |
setAttribute(Object object,
String attribute,
Object newValue)
|
static void |
setAttribute2(Object newValue,
Object object,
String property)
This is so we don't have to reorder the stack when we call this method. |
static void |
setAttributeSafe2(Object newValue,
Object object,
String property)
This is so we don't have to reorder the stack when we call this method. |
static void |
setGroovyObjectProperty(Object newValue,
GroovyObject object,
String property)
This is so we don't have to reorder the stack when we call this method. |
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 short |
shortUnbox(Object value)
|
static Object |
spreadList(Object value)
|
static Object |
spreadMap(Object value)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Object[] EMPTY_ARGS
Constructor Detail |
---|
public ScriptBytecodeAdapter()
Method Detail |
---|
public static Object invokeMethod(Object object, String methodName, Object arguments) throws Throwable
Throwable
public static Object invokeMethodSafe(Object object, String methodName, Object arguments) throws Throwable
Throwable
public static Object invokeMethodSpreadSafe(Object object, String methodName, Object arguments) throws Throwable
Throwable
public static Object invokeStaticMethod(String type, String methodName, Object arguments) throws Throwable
Throwable
public static Object invokeConstructorAt(Class at, Class type, Object arguments) throws Throwable
Throwable
public static Object invokeNoArgumentsConstructorAt(Class at, Class type) throws Throwable
Throwable
public static Object invokeConstructorOf(Class type, Object arguments) throws Throwable
Throwable
public static Object invokeNoArgumentsConstructorOf(Class type) throws Throwable
Throwable
public static Object invokeClosure(Object closure, Object arguments) throws Throwable
Throwable
public static Object invokeSuperMethod(Object object, String methodName, Object arguments) throws Throwable
Throwable
public static Object invokeNoArgumentsMethod(Object object, String methodName) throws Throwable
Throwable
public static Object invokeNoArgumentsMethodSafe(Object object, String methodName) throws Throwable
Throwable
public static Object invokeNoArgumentsMethodSpreadSafe(Object object, String methodName) throws Throwable
Throwable
public static Object invokeStaticNoArgumentsMethod(String type, String methodName) throws Throwable
Throwable
public static int asInt(Object value) throws Throwable
Throwable
public static Object asType(Object object, Class type) throws Throwable
type
- of object to convert the given object toobject
- the object to be converted
Throwable
public static Object getAttribute(Object object, String attribute) throws Throwable
Throwable
public static Object getAttributeSafe(Object object, String attribute) throws Throwable
Throwable
public static Object getAttributeSpreadSafe(Object object, String attribute) throws Throwable
Throwable
public static void setAttribute(Object object, String attribute, Object newValue) throws Throwable
Throwable
public static void setAttribute2(Object newValue, Object object, String property) throws Throwable
Throwable
public static void setAttributeSafe2(Object newValue, Object object, String property) throws Throwable
Throwable
public static Object getProperty(Object object, String property) throws Throwable
Throwable
public static Object getPropertySafe(Object object, String property) throws Throwable
Throwable
public static Object getPropertySpreadSafe(Object object, String property) throws Throwable
Throwable
public static void setProperty(Object object, String property, Object newValue) throws Throwable
Throwable
public static void setProperty2(Object newValue, Object object, String property) throws Throwable
Throwable
public static void setPropertySafe2(Object newValue, Object object, String property) throws Throwable
Throwable
public static void setGroovyObjectProperty(Object newValue, GroovyObject object, String property) throws Throwable
Throwable
public static Object getGroovyObjectProperty(GroovyObject object, String property) throws Throwable
Throwable
public static Closure getMethodPointer(Object object, String methodName)
public static Iterator asIterator(Object collection) throws Throwable
Throwable
public static boolean asBool(Object object) throws Throwable
Throwable
public static boolean notBoolean(boolean bool)
public static boolean notObject(Object object) throws Throwable
Throwable
public static Pattern regexPattern(Object regex) throws Throwable
Throwable
public static Object spreadList(Object value) throws Throwable
Throwable
public static Object spreadMap(Object value) throws Throwable
Throwable
public static Object negate(Object value) throws Throwable
Throwable
public static Object bitNegate(Object value) throws Throwable
Throwable
public static Object[] convertPrimitiveArray(Object a, Class type) throws Throwable
a
- array of primitivestype
- component type of the array
Throwable
public static Object convertToPrimitiveArray(Object a, Class type) throws Throwable
Throwable
public static boolean compareIdentical(Object left, Object right)
public static boolean compareEqual(Object left, Object right) throws Throwable
Throwable
public static boolean compareNotEqual(Object left, Object right) throws Throwable
Throwable
public static Integer compareTo(Object left, Object right) throws Throwable
Throwable
public static Matcher findRegex(Object left, Object right) throws Throwable
Throwable
public static boolean matchRegex(Object left, Object right) throws Throwable
Throwable
public static boolean compareLessThan(Object left, Object right) throws Throwable
Throwable
public static boolean compareLessThanEqual(Object left, Object right) throws Throwable
Throwable
public static boolean compareGreaterThan(Object left, Object right) throws Throwable
Throwable
public static boolean compareGreaterThanEqual(Object left, Object right) throws Throwable
Throwable
public static boolean isCase(Object switchValue, Object caseExpression) throws Throwable
Throwable
public static Tuple createTuple(Object[] array) throws Throwable
Throwable
public static List createList(Object[] values) throws Throwable
Throwable
public static Map createMap(Object[] values) throws Throwable
Throwable
public static List createRange(Object from, Object to, boolean inclusive) throws Throwable
Throwable
public static void assertFailed(Object expression, Object message)
public static Object box(boolean value)
public static Object box(byte value)
public static Object box(char value)
public static Object box(short value)
public static Object box(int value)
public static Object box(long value)
public static Object box(float value)
public static Object box(double value)
public static Integer integerValue(int v)
v
-
public static byte byteUnbox(Object value) throws Throwable
Throwable
public static char charUnbox(Object value) throws Throwable
Throwable
public static short shortUnbox(Object value) throws Throwable
Throwable
public static int intUnbox(Object value) throws Throwable
Throwable
public static boolean booleanUnbox(Object value) throws Throwable
Throwable
public static long longUnbox(Object value) throws Throwable
Throwable
public static float floatUnbox(Object value) throws Throwable
Throwable
public static double doubleUnbox(Object value) throws Throwable
Throwable
public static MetaClass getMetaClass(Object object)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |