public final class RobotReflection extends Object
When robot classes are loaded, calls to methods that use members via reflection, e.g. Method.invoke(java.lang.Object, java.lang.Object...),
Field.get(java.lang.Object), and AccessibleObject.setAccessible(java.lang.reflect.AccessibleObject[], boolean), are replaced with calls to the corresponding static
methods of this class, which take the member as the first parameter. These methods check that the robot is allowed
to use the member, i.e. that the member belongs to a class of the robot, or that robots are allowed to use the
member directly in their code. Robots should not use this class directly.
| Modifier and Type | Method and Description |
|---|---|
static Object |
get(Field field,
Object obj) |
static boolean |
getBoolean(Field field,
Object obj) |
static byte |
getByte(Field field,
Object obj) |
static char |
getChar(Field field,
Object obj) |
static double |
getDouble(Field field,
Object obj) |
static float |
getFloat(Field field,
Object obj) |
static int |
getInt(Field field,
Object obj) |
static long |
getLong(Field field,
Object obj) |
static short |
getShort(Field field,
Object obj) |
static Object |
invoke(Method method,
Object obj,
Object[] args) |
static Object |
newInstance(Class<?> type) |
static Object |
newInstance(Constructor<?> constructor,
Object[] args) |
static void |
set(Field field,
Object obj,
Object value) |
static void |
setAccessible(AccessibleObject object,
boolean flag) |
static void |
setAccessible(Constructor<?> constructor,
boolean flag) |
static void |
setAccessible(Executable executable,
boolean flag) |
static void |
setAccessible(Field field,
boolean flag) |
static void |
setAccessible(Method method,
boolean flag) |
static void |
setBoolean(Field field,
Object obj,
boolean value) |
static void |
setByte(Field field,
Object obj,
byte value) |
static void |
setChar(Field field,
Object obj,
char value) |
static void |
setDouble(Field field,
Object obj,
double value) |
static void |
setFloat(Field field,
Object obj,
float value) |
static void |
setInt(Field field,
Object obj,
int value) |
static void |
setLong(Field field,
Object obj,
long value) |
static void |
setShort(Field field,
Object obj,
short value) |
public static Object invoke(Method method, Object obj, Object[] args) throws IllegalAccessException, InvocationTargetException
public static Object newInstance(Constructor<?> constructor, Object[] args) throws InstantiationException, IllegalAccessException, InvocationTargetException
public static Object newInstance(Class<?> type) throws InstantiationException, IllegalAccessException
public static Object get(Field field, Object obj) throws IllegalAccessException
IllegalAccessExceptionpublic static boolean getBoolean(Field field, Object obj) throws IllegalAccessException
IllegalAccessExceptionpublic static byte getByte(Field field, Object obj) throws IllegalAccessException
IllegalAccessExceptionpublic static char getChar(Field field, Object obj) throws IllegalAccessException
IllegalAccessExceptionpublic static short getShort(Field field, Object obj) throws IllegalAccessException
IllegalAccessExceptionpublic static int getInt(Field field, Object obj) throws IllegalAccessException
IllegalAccessExceptionpublic static long getLong(Field field, Object obj) throws IllegalAccessException
IllegalAccessExceptionpublic static float getFloat(Field field, Object obj) throws IllegalAccessException
IllegalAccessExceptionpublic static double getDouble(Field field, Object obj) throws IllegalAccessException
IllegalAccessExceptionpublic static void set(Field field, Object obj, Object value) throws IllegalAccessException
IllegalAccessExceptionpublic static void setBoolean(Field field, Object obj, boolean value) throws IllegalAccessException
IllegalAccessExceptionpublic static void setByte(Field field, Object obj, byte value) throws IllegalAccessException
IllegalAccessExceptionpublic static void setChar(Field field, Object obj, char value) throws IllegalAccessException
IllegalAccessExceptionpublic static void setShort(Field field, Object obj, short value) throws IllegalAccessException
IllegalAccessExceptionpublic static void setInt(Field field, Object obj, int value) throws IllegalAccessException
IllegalAccessExceptionpublic static void setLong(Field field, Object obj, long value) throws IllegalAccessException
IllegalAccessExceptionpublic static void setFloat(Field field, Object obj, float value) throws IllegalAccessException
IllegalAccessExceptionpublic static void setDouble(Field field, Object obj, double value) throws IllegalAccessException
IllegalAccessExceptionpublic static void setAccessible(AccessibleObject object, boolean flag)
public static void setAccessible(Executable executable, boolean flag)
public static void setAccessible(Method method, boolean flag)
public static void setAccessible(Constructor<?> constructor, boolean flag)
public static void setAccessible(Field field, boolean flag)
Copyright © 2001-2026 Robocode. All Rights Reserved.