| Modifier and Type | Class and Description |
|---|---|
static interface |
Fields.ObjectTransformer
Function enabling an object field value to be replaced with another value when being copied
within
Fields.copy(Object, Object, ObjectTransformer). |
| Modifier and Type | Field and Description |
|---|---|
protected long[] |
offsets
Offsets used with
Unsafe to access the fields. |
| Modifier | Constructor and Description |
|---|---|
protected |
Fields(List<? extends FieldsScanner.FieldInfo> fields) |
| Modifier and Type | Method and Description |
|---|---|
void |
appendFields(StringBuilder sb) |
void |
copy(Object from,
Object to)
Copies fields from
from to to, both of which must be of the same type. |
void |
copy(Object from,
Object to,
Fields.ObjectTransformer trans)
Copies fields from
from to to, both of which must be of the same type. |
static Fields |
create(ArrayList<? extends FieldsScanner.FieldInfo> fields) |
static Fields |
forClass(Class<?> clazz,
Class<?> endClazz,
boolean includeTransient,
FieldsScanner.CalcOffset calcOffset) |
Object |
get(Object object,
int index)
Gets the value of a field for a given object.
|
boolean |
getBoolean(Object n,
int i) |
byte |
getByte(Object n,
int i) |
char |
getChar(Object n,
int i) |
int |
getCount()
Gets the number of fields represented by this object.
|
Class<?> |
getDeclaringClass(int index) |
double |
getDouble(Object n,
int i) |
float |
getFloat(Object n,
int i) |
int |
getInt(Object n,
int i) |
long |
getLong(Object n,
int i) |
String |
getName(int index)
Gets the name of a field.
|
Object |
getObject(Object object,
int i) |
long[] |
getOffsets() |
long |
getRawPrimitive(Object object,
int index)
Gets the value of a field for a given object.
|
short |
getShort(Object n,
int i) |
Class<?> |
getType(int index)
Gets the type of a field.
|
boolean |
isSame(Fields other,
int index)
Determines if a field in the domain of this object is the same as the field denoted by the
same index in another
Fields object. |
void |
putObject(Object object,
int i,
Object value) |
void |
putObjectChecked(Object object,
int i,
Object value) |
void |
setRawPrimitive(Object object,
int index,
long value) |
String |
toString() |
static void |
translateInto(Fields fields,
ArrayList<FieldsScanner.FieldInfo> infos) |
protected Fields(List<? extends FieldsScanner.FieldInfo> fields)
public static Fields forClass(Class<?> clazz, Class<?> endClazz, boolean includeTransient, FieldsScanner.CalcOffset calcOffset)
public static Fields create(ArrayList<? extends FieldsScanner.FieldInfo> fields)
public int getCount()
public static void translateInto(Fields fields, ArrayList<FieldsScanner.FieldInfo> infos)
public void copy(Object from, Object to)
from to to, both of which must be of the same type.from - the object from which the fields should be copiedto - the object to which the fields should be copiedpublic void copy(Object from, Object to, Fields.ObjectTransformer trans)
from to to, both of which must be of the same type.from - the object from which the fields should be copiedto - the object to which the fields should be copiedtrans - function to applied to object field values as they are copied. If null,
the value is copied unchanged.public Object get(Object object, int index)
object - the object whose field is to be readindex - the index of the field (between 0 and Fields.getCount())public long getRawPrimitive(Object object, int index)
object - the object whose field is to be readindex - the index of the field (between 0 and Fields.getCount())public boolean isSame(Fields other, int index)
Fields object.public long[] getOffsets()
public String getName(int index)
index - index of a fieldpublic Class<?> getType(int index)
index - index of a fieldpublic Class<?> getDeclaringClass(int index)
public void setRawPrimitive(Object object, int index, long value)
public void appendFields(StringBuilder sb)
public boolean getBoolean(Object n, int i)
public byte getByte(Object n, int i)
public short getShort(Object n, int i)
public char getChar(Object n, int i)
public int getInt(Object n, int i)
public long getLong(Object n, int i)
public float getFloat(Object n, int i)
public double getDouble(Object n, int i)