org.aspectj.apache.bcel.generic
Class FieldGen

java.lang.Object
  extended by org.aspectj.apache.bcel.classfile.Modifiers
      extended by org.aspectj.apache.bcel.generic.FieldGenOrMethodGen
          extended by org.aspectj.apache.bcel.generic.FieldGen

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 the declared type).

See Also:
Field

Field Summary
 
Fields inherited from class org.aspectj.apache.bcel.generic.FieldGenOrMethodGen
annotationList, cp, name, type
 
Fields inherited from class org.aspectj.apache.bcel.classfile.Modifiers
modifiers
 
Constructor Summary
FieldGen(Field field, ConstantPool cp)
          Instantiate from existing field.
FieldGen(int modifiers, Type type, java.lang.String name, ConstantPool cpool)
          Declare a field.
 
Method Summary
 Field getField()
          Get field object after having set up all necessary values.
 java.lang.String getInitialValue()
           
 java.lang.String getSignature()
           
 void setInitialStringValue(java.lang.String value)
           
 void setValue(int index)
           
 void setValue(java.lang.String constantString)
           
 java.lang.String toString()
          Return string representation close to declaration format, `public static final short MAX = 100', e.g..
 void wipeValue()
           
 
Methods inherited from class org.aspectj.apache.bcel.generic.FieldGenOrMethodGen
addAnnotation, addAnnotationsAsAttribute, addAttribute, getAnnotations, getAttributes, getAttributesImmutable, getConstantPool, getName, getType, removeAnnotation, removeAnnotations, removeAttribute, removeAttributes, setConstantPool, setName, setType
 
Methods inherited from class org.aspectj.apache.bcel.classfile.Modifiers
getModifiers, isAbstract, isBridge, isFinal, isInterface, isNative, isPrivate, isProtected, isPublic, isStatic, isStrictfp, isSynchronized, isTransient, isVarargs, isVolatile, setModifiers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FieldGen

public FieldGen(int modifiers,
                Type type,
                java.lang.String name,
                ConstantPool cpool)
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:
modifiers - access qualifiers
type - field type
name - field name
cpool - constant pool

FieldGen

public FieldGen(Field field,
                ConstantPool cp)
Instantiate from existing field.

Parameters:
field - Field object
cp - constant pool (must contain the same entries as the field's constant pool)
Method Detail

setValue

public void setValue(int index)

setValue

public void setValue(java.lang.String constantString)

wipeValue

public void wipeValue()

getField

public Field getField()
Get field object after having set up all necessary values.


getSignature

public java.lang.String getSignature()
Specified by:
getSignature in class FieldGenOrMethodGen

getInitialValue

public java.lang.String getInitialValue()

setInitialStringValue

public void setInitialStringValue(java.lang.String value)

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