public interface Field
This is the basic interface which describes a field in a C/C++ data structure or a Java object.
The accessors in this class are designed to allow manual coercion of the data within the field, which is often necessary when interfacing with C programs. Therefore, the accessors here do not perform any type checking. Specializations of the Field interface, such as JByteField, provide getValue() methods which both perform type checking and return the appropriate specialized type.
See @see CIntegerType for a description of why all C integer types are bundled into the category "CIntegerType".
As an example, coercing a pointer field into an int can be done in the following fashion (assuming the application has registered an integer type in the type database called "intptr_t"):
{ ... Address myObject = ...; CIntegerType intptr_tType = (CIntegerType) db.lookupType("intptr_t"); long addrVal = field.getCInteger(myObject, intptr_tType); ... }FIXME: among other things, this interface is not sufficient to describe fields which are themselves arrays (like Symbol's jbyte _body[1]).
Modifier and Type | Method and Description |
---|---|
Address |
getAddress() |
Address |
getAddress(Address addr) |
long |
getCInteger(Address addr,
CIntegerType type) |
long |
getCInteger(CIntegerType type) |
boolean |
getJBoolean()
These accessors require that the field be static; otherwise,
a WrongTypeException will be thrown.
|
boolean |
getJBoolean(Address addr)
These accessors require that the field be nonstatic;
otherwise, a WrongTypeException will be thrown.
|
byte |
getJByte() |
byte |
getJByte(Address addr) |
char |
getJChar() |
char |
getJChar(Address addr) |
double |
getJDouble() |
double |
getJDouble(Address addr) |
float |
getJFloat() |
float |
getJFloat(Address addr) |
int |
getJInt() |
int |
getJInt(Address addr) |
long |
getJLong() |
long |
getJLong(Address addr) |
short |
getJShort() |
short |
getJShort(Address addr) |
java.lang.String |
getName()
Get the name of this field
|
OopHandle |
getNarrowOopHandle() |
OopHandle |
getNarrowOopHandle(Address addr) |
long |
getOffset()
The offset of this field, in bytes, in its containing data
structure, if nonstatic.
|
OopHandle |
getOopHandle() |
OopHandle |
getOopHandle(Address addr) |
long |
getSize()
Get the size, in bytes, of this field.
|
Address |
getStaticFieldAddress()
The address of this field, if it is a static field.
|
Type |
getType()
Get the type of this field
|
boolean |
isStatic()
Is this a static field?
|
java.lang.String getName()
Type getType()
long getSize()
boolean isStatic()
long getOffset() throws WrongTypeException
WrongTypeException
Address getStaticFieldAddress() throws WrongTypeException
WrongTypeException
boolean getJBoolean(Address addr) throws UnmappedAddressException, UnalignedAddressException, WrongTypeException
These accessors require that the field be nonstatic; otherwise, a WrongTypeException will be thrown. Note that type checking is not performed by these accessors in order to allow manual type coercion of field data. For better protection when accessing primitive fields, use the get(Type)Field accessors in Type.java.
NOTE that the Address passed in to these routines may, in fact, be an OopHandle. Specifically, in a reflective system, dereferencing operations applied to the OopHandle must be performed atomically with respect to GC.
See @see CIntegerType for a description of why all C integer types are bundled into the category "CIntegerType".
byte getJByte(Address addr) throws UnmappedAddressException, UnalignedAddressException, WrongTypeException
char getJChar(Address addr) throws UnmappedAddressException, UnalignedAddressException, WrongTypeException
short getJShort(Address addr) throws UnmappedAddressException, UnalignedAddressException, WrongTypeException
int getJInt(Address addr) throws UnmappedAddressException, UnalignedAddressException, WrongTypeException
long getJLong(Address addr) throws UnmappedAddressException, UnalignedAddressException, WrongTypeException
float getJFloat(Address addr) throws UnmappedAddressException, UnalignedAddressException, WrongTypeException
double getJDouble(Address addr) throws UnmappedAddressException, UnalignedAddressException, WrongTypeException
long getCInteger(Address addr, CIntegerType type) throws UnmappedAddressException, UnalignedAddressException, WrongTypeException
Address getAddress(Address addr) throws UnmappedAddressException, UnalignedAddressException, WrongTypeException
OopHandle getOopHandle(Address addr) throws UnmappedAddressException, UnalignedAddressException, WrongTypeException, NotInHeapException
OopHandle getNarrowOopHandle(Address addr) throws UnmappedAddressException, UnalignedAddressException, WrongTypeException, NotInHeapException
boolean getJBoolean() throws UnmappedAddressException, UnalignedAddressException, WrongTypeException
These accessors require that the field be static; otherwise, a WrongTypeException will be thrown. Note that type checking is not performed by these accessors in order to allow manual type coercion of field data. For better protection when accessing primitive fields, use the get(Type)Field accessors in Type.java.
NOTE that the Address passed in to these routines may, in fact, be an OopHandle. Specifically, in a reflective system, dereferencing operations applied to the OopHandle must be performed atomically with respect to GC.
See @see CIntegerType for a description of why all C integer types are bundled into the category "CIntegerType".
byte getJByte() throws UnmappedAddressException, UnalignedAddressException, WrongTypeException
char getJChar() throws UnmappedAddressException, UnalignedAddressException, WrongTypeException
float getJFloat() throws UnmappedAddressException, UnalignedAddressException, WrongTypeException
double getJDouble() throws UnmappedAddressException, UnalignedAddressException, WrongTypeException
int getJInt() throws UnmappedAddressException, UnalignedAddressException, WrongTypeException
long getJLong() throws UnmappedAddressException, UnalignedAddressException, WrongTypeException
short getJShort() throws UnmappedAddressException, UnalignedAddressException, WrongTypeException
long getCInteger(CIntegerType type) throws UnmappedAddressException, UnalignedAddressException, WrongTypeException
Address getAddress() throws UnmappedAddressException, UnalignedAddressException
OopHandle getOopHandle() throws UnmappedAddressException, UnalignedAddressException, NotInHeapException
OopHandle getNarrowOopHandle() throws UnmappedAddressException, UnalignedAddressException, NotInHeapException
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.