de.fub.bytecode.generic
Class FieldGen

java.lang.Object
  |
  +--de.fub.bytecode.classfile.AccessFlags
        |
        +--de.fub.bytecode.generic.FieldGen

public class FieldGen
extends AccessFlags
implements Constants

Template class for building up a field. The only reasonable thing one can do is a constant value attribute to a field which must of course be compatible with to the declared type.

Version:
$Id: FieldGen.java,v 1.9 1999/08/13 08:18:29 dahm Exp $
Author:
M. Dahm
See Also:
Field

Fields inherited from class de.fub.bytecode.classfile.AccessFlags
access_flags
 
Constructor Summary
FieldGen(int access_flags, Type type, java.lang.String name, ConstantPoolGen cp)
           
FieldGen(int access_flags, Type type, java.lang.String name, java.lang.String class_name, ConstantPoolGen cp)
          Declare a field.
 
Method Summary
 void addAttribute(Attribute attr)
           
 Attribute[] getAttributes()
           
 java.lang.String getClassName()
           
 ConstantPoolGen getConstantPool()
           
 Field getField()
          Get method object.
 java.lang.String getName()
           
 java.lang.String getSignature()
           
 Type getType()
           
 void setConstantPool(ConstantPoolGen cp)
           
 void setInitValue(boolean b)
           
 void setInitValue(byte b)
           
 void setInitValue(char c)
           
 void setInitValue(double d)
           
 void setInitValue(float f)
           
 void setInitValue(int i)
           
 void setInitValue(long l)
           
 void setInitValue(short s)
           
 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.
 void setName(java.lang.String name)
           
 void setType(Type type)
           
 
Methods inherited from class de.fub.bytecode.classfile.AccessFlags
getAccessFlags, isAbstract, isAbstract, isFinal, isFinal, isInterface, isInterface, isNative, isNative, isPrivate, isPrivate, isProtected, isProtected, isPublic, isPublic, isStatic, isStatic, isSynchronized, isSynchronized, isTransient, isTransient, isVolatile, isVolatile, setAccessFlags
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldGen

public FieldGen(int access_flags,
                Type type,
                java.lang.String name,
                java.lang.String class_name,
                ConstantPoolGen cp)
Declare a field. If it is a static field (access_flags & ACC_STATIC != 0) it may have an initial value associated with it as defined by setInitValue().
Parameters:
access_flags - access qualifiers
type - field type
name - field name
class_name - class name containing this method (may be null, if you don't care)
cp - constant pool

FieldGen

public FieldGen(int access_flags,
                Type type,
                java.lang.String name,
                ConstantPoolGen cp)
Method Detail

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)

addAttribute

public void addAttribute(Attribute attr)

getAttributes

public Attribute[] getAttributes()

getField

public Field getField()
Get method object.

setType

public void setType(Type type)

getType

public Type getType()

setName

public void setName(java.lang.String name)

getName

public java.lang.String getName()

getClassName

public java.lang.String getClassName()

getSignature

public java.lang.String getSignature()

getConstantPool

public ConstantPoolGen getConstantPool()

setConstantPool

public void setConstantPool(ConstantPoolGen cp)