bcel API: Class FieldGen
org.apache.bcel.generic
Class FieldGen
java.lang.Object
|
+--org.apache.bcel.classfile.AccessFlags
|
+--org.apache.bcel.generic.FieldGenOrMethodGen
|
+--org.apache.bcel.generic.FieldGen
All Implemented Interfaces: java.lang.Cloneable, NamedAndTyped
public class FieldGen extends FieldGenOrMethodGen
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).
Version: $Id: FieldGen.java,v 1.1.1.1 2001/10/29 20:00:12 jvanzyl Exp $
Author: M. Dahm
See Also: Field
Methods inherited from class org.apache.bcel.generic.FieldGenOrMethodGen
addAttribute , clone , getAttributes , getConstantPool , getName , getType , removeAttribute , removeAttributes , setConstantPool , setName , setType
Methods inherited from class org.apache.bcel.classfile.AccessFlags
getAccessFlags , isAbstract , isAbstract , isFinal , isFinal , isInterface , isInterface , isNative , isNative , isPrivate , isPrivate , isProtected , isProtected , isPublic , isPublic , isStatic , isStatic , isStrictfp , isStrictfp , isSynchronized , isSynchronized , isTransient , isTransient , isVolatile , isVolatile , setAccessFlags
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
FieldGen
public FieldGen (int access_flags,
Type type,
java.lang.String name,
ConstantPoolGen cp)
Declare a field. If it is static (isStatic() == true) and has a
basic type like int or String it may have an initial value
associated with it as defined by setInitValue().
Parameters: access_flags
- access qualifierstype
- field typename
- field namecp
- constant pool
FieldGen
public FieldGen (Field field,
ConstantPoolGen cp)
Instantiate from existing field.
Parameters: field
- Field objectcp
- constant pool (must contain the same entries as the field's constant pool)
setInitValue
public void setInitValue (java.lang.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 (long l)
setInitValue
public void setInitValue (int i)
setInitValue
public void setInitValue (short s)
setInitValue
public void setInitValue (char c)
setInitValue
public void setInitValue (byte b)
setInitValue
public void setInitValue (boolean b)
setInitValue
public void setInitValue (float f)
setInitValue
public void setInitValue (double d)
cancelInitValue
public void cancelInitValue ()
Remove any initial value.
getField
public Field getField ()
Get field object after having set up all necessary values.
getSignature
public java.lang.String getSignature ()
Overrides: getSignature
in class FieldGenOrMethodGen
Following copied from class: org.apache.bcel.generic.FieldGenOrMethodGen
Returns: signature of method/field.
addObserver
public void addObserver (FieldObserver o)
Add observer for this object.
removeObserver
public void removeObserver (FieldObserver o)
Remove observer for this object.
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.
getInitValue
public java.lang.String getInitValue ()
toString
public final java.lang.String toString ()
Return string representation close to declaration format,
`public static final short MAX = 100', e.g..
Overrides: toString
in class java.lang.Object
Returns: String representation of field
copy
public FieldGen copy (ConstantPoolGen cp)
Returns: deep copy of this field