Template class for building up a field. The only extraordinary thing
one can do is to add a constant value attribute to a field (which must of
course be compatible with to the declared type).
addConstant
private int addConstant()
addObserver
public void addObserver(FieldObserver o)
Add observer for this object.
cancelInitValue
public void cancelInitValue()
Remove any initial value.
checkType
private void checkType(Type atype)
equals
public boolean equals(Object obj)
Return value as defined by given BCELComparator strategy.
By default two FieldGen objects are said to be equal when
their names and signatures are equal.
java.lang.Object.equals(java.lang.Object)
getComparator
public static BCELComparator getComparator()
- Comparison strategy object
getField
public Field getField()
Get field object after having set up all necessary values.
getInitValue
public String getInitValue()
hashCode
public int hashCode()
Return value as defined by given BCELComparator strategy.
By default return the hashcode of the field's name XOR signature.
java.lang.Object.hashCode()
removeObserver
public void removeObserver(FieldObserver o)
Remove observer for this object.
setComparator
public static void setComparator(BCELComparator comparator)
comparator
- Comparison strategy object
setInitValue
public void setInitValue(String str)
Set (optional) initial value of field, otherwise it will be set to null/0/false
by the JVM automatically.
setInitValue
public void setInitValue(boolean b)
setInitValue
public void setInitValue(byte b)
setInitValue
public void setInitValue(char c)
setInitValue
public void setInitValue(double d)
setInitValue
public void setInitValue(float f)
setInitValue
public void setInitValue(int i)
setInitValue
public void setInitValue(long l)
setInitValue
public void setInitValue(short s)
setValue
private void setValue(int index)
toString
public final String toString()
Return string representation close to declaration format,
`public static final short MAX = 100', e.g..
- String representation of field
update
public void update()
Call notify() method on all observers. This method is not called
automatically whenever the state has changed, but has to be
called by the user after he has finished editing the object.