Top Description Fields Constructors Methods
org.aspectj.apache.bcel.generic

public Class FieldGen

extends FieldGenOrMethodGen
Class Inheritance
Imports
java.util.List, org.aspectj.apache.bcel.Constants, org.aspectj.apache.bcel.classfile.Attribute, .Constant, .ConstantDouble, .ConstantFloat, .ConstantInteger, .ConstantLong, .ConstantObject, .ConstantPool, .ConstantString, .ConstantValue, .Field, .Utility, org.aspectj.apache.bcel.classfile.annotation.AnnotationGen, .RuntimeAnnos

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).
Author
M. Dahm
Version
$Id: FieldGen.java,v 1.11 2011/10/03 22:41:24 aclement Exp $
See Also
Field

Field Summary

Modifier and TypeField and Description
private Object
Inherited from org.aspectj.apache.bcel.generic.FieldGenOrMethodGen:
annotationListcpnametype

Constructor Summary

AccessConstructor and Description
public
FieldGen(int
access qualifiers
modifiers
,
Type
field type
type
,
String
field name
name
,
ConstantPool
constant pool
cpool
)

Declare a field.

public
FieldGen(Field
Field object
field
,
ConstantPool
constant pool (must contain the same entries as the field's constant pool)
cp
)

Instantiate from existing field.

Method Summary

Modifier and TypeMethod and Description
private int
private void
checkType(Type atype)

public Field
getField()

Get field object after having set up all necessary values.

public String
public String
public void
public void
setValue(int index)

public void
setValue(String constantString)

public final String
toString()

Overrides java.lang.Object.toString.

Return string representation close to declaration format, `public static final short MAX = 100', e.g..
public void
Inherited from org.aspectj.apache.bcel.generic.FieldGenOrMethodGen:
addAnnotationaddAnnotationsAsAttributeaddAttributegetAnnotationsgetAttributesgetAttributesImmutablegetConstantPoolgetNamegetTyperemoveAnnotationremoveAnnotationsremoveAttributeremoveAttributessetConstantPoolsetNamesetType

Field Detail

valueback to summary
private Object value

Constructor Detail

FieldGenback to summary
public FieldGen(int modifiers, Type type, 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:int

access qualifiers

type:Type

field type

name:String

field name

cpool:ConstantPool

constant pool

FieldGenback to summary
public FieldGen(Field field, ConstantPool cp)

Instantiate from existing field.

Parameters
field:Field

Field object

cp:ConstantPool

constant pool (must contain the same entries as the field's constant pool)

Method Detail

addConstantback to summary
private int addConstant()
checkTypeback to summary
private void checkType(Type atype)
getFieldback to summary
public Field getField()

Get field object after having set up all necessary values.

getInitialValueback to summary
public String getInitialValue()
getSignatureback to summary
public String getSignature()

Implements abstract org.aspectj.apache.bcel.generic.FieldGenOrMethodGen.getSignature.

Annotations
@Override
setInitialStringValueback to summary
public void setInitialStringValue(String value)
setValueback to summary
public void setValue(int index)
setValueback to summary
public void setValue(String constantString)
toStringback to summary
public final String toString()

Overrides java.lang.Object.toString.

Return string representation close to declaration format, `public static final short MAX = 100', e.g..

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object.

Annotations
@Override
wipeValueback to summary
public void wipeValue()