public abstract class Fields extends Object implements Cloneable
Modifier and Type | Field and Description |
---|---|
protected Object[] |
fieldAttrs
we use this to store arbitrary field attributes (like symbolic values),
but only pushClinit this on demand
|
protected Object |
objectAttr
attribute attached to the object as a whole
|
Modifier | Constructor and Description |
---|---|
protected |
Fields() |
Modifier and Type | Method and Description |
---|---|
void |
addFieldAttr(int nFieldsOrElements,
int fieldOrElementIndex,
Object attr) |
void |
addObjectAttr(Object attr) |
abstract void |
appendTo(IntVector v) |
abstract int[] |
asFieldSlots() |
abstract Fields |
clone() |
protected Fields |
cloneFields() |
protected boolean |
compareAttrs(Fields f) |
void |
copyAttrs(Fields other) |
abstract boolean |
equals(Object o)
default implementation is just an identity check
|
ObjectList.Iterator |
fieldAttrIterator(int fieldOrElementIndex) |
<T> ObjectList.TypedIterator<T> |
fieldAttrIterator(int fieldOrElementIndex,
Class<T> type) |
abstract boolean |
getBooleanValue(int index) |
abstract byte |
getByteValue(int index) |
abstract char |
getCharValue(int index) |
abstract double |
getDoubleValue(int index) |
Object |
getFieldAttr(int fieldOrElementIndex)
this returns all of them - use either if you know there will be only
one attribute at a time, or check/process result with ObjectList
|
<T> T |
getFieldAttr(int fieldOrElementIndex,
Class<T> type)
this only returns the first attr of this type, there can be more
if you don't use client private types or the provided type is too general
|
abstract float |
getFloatValue(int index) |
abstract int |
getHeapSize()
give an approximation of the heap size in bytes - we assume fields are word
aligned, hence the number of values*4 should be good.
|
abstract int |
getIntValue(int index) |
abstract long |
getLongValue(int index) |
<T> T |
getNextFieldAttr(int fieldOrElementIndex,
Class<T> type,
Object prev) |
<T> T |
getNextObjectAttr(Class<T> attrType,
Object prev) |
Object |
getObjectAttr()
this returns all of them - use either if you know there will be only
one attribute at a time, or check/process result with ObjectList
|
<T> T |
getObjectAttr(Class<T> attrType)
this only returns the first attr of this type, there can be more
if you don't use client private types or the provided type is too general
|
abstract int |
getReferenceValue(int index) |
abstract short |
getShortValue(int index) |
boolean |
hasFieldAttr() |
boolean |
hasFieldAttr(Class<?> attrType) |
boolean |
hasFieldAttr(int fieldOrElementIndex,
Class<?> type) |
abstract void |
hash(HashData hd) |
void |
hashAttrs(HashData hd)
Adds some data to the computation of an hashcode.
|
int |
hashCode() |
boolean |
hasObjectAttr() |
boolean |
hasObjectAttr(Class<?> attrType) |
boolean |
isReferenceArray() |
ObjectList.Iterator |
objectAttrIterator() |
<T> ObjectList.TypedIterator<T> |
objectAttrIterator(Class<T> attrType) |
void |
removeFieldAttr(int fieldOrElementIndex,
Object attr) |
void |
removeObjectAttr(Object attr) |
void |
replaceFieldAttr(int fieldOrElementIndex,
Object oldAttr,
Object newAttr) |
void |
replaceObjectAttr(Object oldAttr,
Object newAttr) |
abstract void |
setBooleanValue(int index,
boolean newValue) |
abstract void |
setByteValue(int index,
byte newValue) |
abstract void |
setCharValue(int index,
char newValue) |
abstract void |
setDoubleValue(int index,
double newValue) |
void |
setFieldAttr(int nFieldsOrElements,
int fieldOrElementIndex,
Object attr)
this replaces all of them - use only if you know
- there will be only one attribute at a time
- you obtained the value you set by a previous getXAttr()
- you constructed a multi value list with ObjectList.createList()
|
abstract void |
setFloatValue(int index,
float newValue) |
abstract void |
setIntValue(int index,
int newValue) |
abstract void |
setLongValue(int index,
long newValue) |
void |
setObjectAttr(Object attr)
this replaces all of them - use only if you know
- there will be only one attribute at a time
- you obtained the value you set by a previous getXAttr()
- you constructed a multi value list with ObjectList.createList()
|
abstract void |
setReferenceValue(int index,
int newValue) |
abstract void |
setShortValue(int index,
short newValue) |
protected Object[] fieldAttrs
protected Object objectAttr
public boolean hasFieldAttr()
public boolean hasFieldAttr(Class<?> attrType)
public Object getFieldAttr(int fieldOrElementIndex)
public void setFieldAttr(int nFieldsOrElements, int fieldOrElementIndex, Object attr)
public void addFieldAttr(int nFieldsOrElements, int fieldOrElementIndex, Object attr)
public void removeFieldAttr(int fieldOrElementIndex, Object attr)
public void replaceFieldAttr(int fieldOrElementIndex, Object oldAttr, Object newAttr)
public boolean hasFieldAttr(int fieldOrElementIndex, Class<?> type)
public <T> T getFieldAttr(int fieldOrElementIndex, Class<T> type)
public ObjectList.Iterator fieldAttrIterator(int fieldOrElementIndex)
public <T> ObjectList.TypedIterator<T> fieldAttrIterator(int fieldOrElementIndex, Class<T> type)
public boolean hasObjectAttr()
public boolean hasObjectAttr(Class<?> attrType)
public Object getObjectAttr()
public void setObjectAttr(Object attr)
public void addObjectAttr(Object attr)
public void removeObjectAttr(Object attr)
public <T> T getObjectAttr(Class<T> attrType)
public ObjectList.Iterator objectAttrIterator()
public <T> ObjectList.TypedIterator<T> objectAttrIterator(Class<T> attrType)
public abstract int[] asFieldSlots()
public abstract int getHeapSize()
public boolean isReferenceArray()
public abstract int getIntValue(int index)
public abstract int getReferenceValue(int index)
public abstract long getLongValue(int index)
public abstract boolean getBooleanValue(int index)
public abstract byte getByteValue(int index)
public abstract char getCharValue(int index)
public abstract short getShortValue(int index)
public abstract float getFloatValue(int index)
public abstract double getDoubleValue(int index)
public abstract void setReferenceValue(int index, int newValue)
public abstract void setBooleanValue(int index, boolean newValue)
public abstract void setByteValue(int index, byte newValue)
public abstract void setCharValue(int index, char newValue)
public abstract void setShortValue(int index, short newValue)
public abstract void setFloatValue(int index, float newValue)
public abstract void setIntValue(int index, int newValue)
public abstract void setLongValue(int index, long newValue)
public abstract void setDoubleValue(int index, double newValue)
protected Fields cloneFields()
public abstract boolean equals(Object o)
Object
protected boolean compareAttrs(Fields f)
public abstract void appendTo(IntVector v)
public abstract void hash(HashData hd)
public void hashAttrs(HashData hd)
public void copyAttrs(Fields other)