Modifier and Type | Field and Description |
---|---|
static long |
INVALID_FIELD_OFFSET
This constant differs from all results that will ever be returned from
objectFieldOffset(java.lang.reflect.Field) . |
Constructor and Description |
---|
BridgeBase() |
Modifier and Type | Method and Description |
---|---|
Class<?> |
defineClass(String className,
byte[] classBytes,
ClassLoader classLoader,
ProtectionDomain protectionDomain)
Defines a class is a specified classloader.
|
void |
ensureClassInitialized(Class<?> cl)
Ensure that the class has been initialized.
|
boolean |
getBoolean(Object o,
long offset) |
byte |
getByte(Object o,
long offset) |
char |
getChar(Object o,
long offset) |
double |
getDouble(Object o,
long offset) |
float |
getFloat(Object o,
long offset) |
int |
getInt(Object o,
long offset)
Fetches a field element within the given
object
o at the given offset. |
abstract ClassLoader |
getLatestUserDefinedLoader()
Obtain the latest user defined ClassLoader from the call stack.
|
long |
getLong(Object o,
long offset) |
<T> T |
getObject(Object o,
long offset) |
short |
getShort(Object o,
long offset) |
abstract boolean |
hasStaticInitializerForSerialization(Class<?> cl)
Returns true if the given class defines a static initializer method,
false otherwise.
|
abstract <T> Constructor<?> |
newConstructorForExternalization(Class<T> cl)
Return a constructor that can be used to create an instance of the class for externalization.
|
abstract <T> Constructor<T> |
newConstructorForSerialization(Class<T> aClass)
Return a no-arg constructor for the specified class, based on the default constructor
for its nearest non-serializable base class.
|
abstract <T> Constructor<T> |
newConstructorForSerialization(Class<T> aClass,
Constructor<?> cons)
Return a no-arg constructor for the specified class which invokes the specified constructor.
|
abstract OptionalDataException |
newOptionalDataExceptionForSerialization(boolean bool)
Return a new OptionalDataException instance.
|
long |
objectFieldOffset(Field f)
Returns the offset of a non-static field, which can be passed into the set...
|
void |
putBoolean(Object o,
long offset,
boolean x) |
void |
putByte(Object o,
long offset,
byte x) |
void |
putChar(Object o,
long offset,
char x) |
void |
putDouble(Object o,
long offset,
double x) |
void |
putFloat(Object o,
long offset,
float x) |
void |
putInt(Object o,
long offset,
int x)
Stores a value into a given Java field.
|
void |
putLong(Object o,
long offset,
long x) |
void |
putObject(Object o,
long offset,
Object x) |
void |
putShort(Object o,
long offset,
short x) |
abstract MethodHandle |
readObjectForSerialization(Class<?> cl)
Returns a method handle to allow invocation of the specified class's readObject method.
|
abstract MethodHandle |
readResolveForSerialization(Class<?> cl)
Returns a method handle to allow invocation of the specified class's readResolve method.
|
long |
staticFieldOffset(Field f) |
void |
throwException(Throwable ee)
Throw the exception.
|
Field |
toAccessibleField(Field field,
Class callingClass)
Returns the specified field after calling setAccessible, if it is accessible from the specified class.
|
Method |
toAccessibleMethod(Method method,
Class callingClass)
Returns the specified method after calling setAccessible, if it is accessible from the specified class.
|
abstract MethodHandle |
writeObjectForSerialization(Class<?> cl)
Returns a method handle to allow invocation of the specified class's writeObject method.
|
abstract MethodHandle |
writeReplaceForSerialization(Class<?> cl)
Returns a method handle to allow invocation of the specified class's writeReplace method.
|
public static final long INVALID_FIELD_OFFSET
objectFieldOffset(java.lang.reflect.Field)
.public final int getInt(Object o, long offset)
o
at the given offset.
The result is undefined unless the offset was obtained from
objectFieldOffset(java.lang.reflect.Field)
on the Field
of some Java field and the object referred to by o
is of a class compatible with that field's class.o
- Java heap object in which the field from which the offset
was obtained residesoffset
- indication of where the field resides in a Java heap
objectRuntimeException
- No defined exceptions are thrown, not even
NullPointerException
public final void putInt(Object o, long offset, int x)
The first two parameters are interpreted exactly as with
getInt(Object, long)
to refer to a specific
Java field. The given value is stored into that field.
The field must be of the same type as the method
parameter x
.
o
- Java heap object in which the field resides, if any, else
nulloffset
- indication of where the field resides in a Java heap
object.x
- the value to store into the indicated Java fieldRuntimeException
- No defined exceptions are thrown, not even
NullPointerException
public final <T> T getObject(Object o, long offset)
getInt(Object, long)
public final void putObject(Object o, long offset, Object x)
putInt(Object, long, int)
public final boolean getBoolean(Object o, long offset)
getInt(Object, long)
public final void putBoolean(Object o, long offset, boolean x)
putInt(Object, long, int)
public final byte getByte(Object o, long offset)
getInt(Object, long)
public final void putByte(Object o, long offset, byte x)
putInt(Object, long, int)
public final short getShort(Object o, long offset)
getInt(Object, long)
public final void putShort(Object o, long offset, short x)
putInt(Object, long, int)
public final char getChar(Object o, long offset)
getInt(Object, long)
public final void putChar(Object o, long offset, char x)
putInt(Object, long, int)
public final long getLong(Object o, long offset)
getInt(Object, long)
public final void putLong(Object o, long offset, long x)
putInt(Object, long, int)
public final float getFloat(Object o, long offset)
getInt(Object, long)
public final void putFloat(Object o, long offset, float x)
putInt(Object, long, int)
public final double getDouble(Object o, long offset)
getInt(Object, long)
public final void putDouble(Object o, long offset, double x)
putInt(Object, long, int)
public final long objectFieldOffset(Field f)
getInt(Object, long)
public final long staticFieldOffset(Field f)
public final void throwException(Throwable ee)
public final Class<?> defineClass(String className, byte[] classBytes, ClassLoader classLoader, ProtectionDomain protectionDomain)
className
- the name of the classclassBytes
- the byte code for the classclassLoader
- the classloader in which it is to be definedprotectionDomain
- the domain in which the class should be definedpublic final void ensureClassInitialized(Class<?> cl)
cl
- the class to ensure is initializedpublic abstract ClassLoader getLatestUserDefinedLoader()
public abstract <T> Constructor<?> newConstructorForExternalization(Class<T> cl)
cl
- the classpublic abstract <T> Constructor<T> newConstructorForSerialization(Class<T> aClass, Constructor<?> cons)
aClass
- the class for which a constructor should be returned.cons
- the default constructor on which to model the new constructor.public abstract <T> Constructor<T> newConstructorForSerialization(Class<T> aClass)
aClass
- the class for which a constructor should be returned.public abstract boolean hasStaticInitializerForSerialization(Class<?> cl)
public abstract MethodHandle writeObjectForSerialization(Class<?> cl) throws NoSuchMethodException, IllegalAccessException
cl
- the class containing the methodNoSuchMethodException
IllegalAccessException
public abstract MethodHandle readObjectForSerialization(Class<?> cl) throws NoSuchMethodException, IllegalAccessException
cl
- the class containing the methodNoSuchMethodException
IllegalAccessException
public abstract MethodHandle readResolveForSerialization(Class<?> cl)
cl
- the class containing the methodpublic abstract MethodHandle writeReplaceForSerialization(Class<?> cl)
cl
- the class containing the methodpublic abstract OptionalDataException newOptionalDataExceptionForSerialization(boolean bool)
public Field toAccessibleField(Field field, Class callingClass)
field
- the field to make accessiblecallingClass
- the class which wants to access it.public Method toAccessibleMethod(Method method, Class callingClass)
method
- the method to make accessiblecallingClass
- the class which wants to access it.Copyright © 2017 Oracle. All rights reserved.