public final class FieldInfo extends Object
field_info structure.
 The following code adds a public field width
 of int type:
 
ClassFile cf = ... FieldInfo f = new FieldInfo(cf.getConstPool(), "width", "I"); f.setAccessFlags(AccessFlag.PUBLIC); cf.addField(f);
CtField.getFieldInfo()| Constructor and Description | 
|---|
| FieldInfo(ConstPool cp,
         String fieldName,
         String desc)Constructs a  field_infostructure. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addAttribute(AttributeInfo info)Appends an attribute. | 
| int | getAccessFlags()Returns the access flags. | 
| AttributeInfo | getAttribute(String name)Returns the attribute with the specified name. | 
| List | getAttributes()Returns all the attributes. | 
| int | getConstantValue()Finds a ConstantValue attribute and returns the index into
 the  constant_pooltable. | 
| ConstPool | getConstPool()Returns the constant pool table used
 by this  field_info. | 
| String | getDescriptor()Returns the field descriptor. | 
| String | getName()Returns the field name. | 
| AttributeInfo | removeAttribute(String name)Removes an attribute with the specified name. | 
| void | setAccessFlags(int acc)Sets the access flags. | 
| void | setDescriptor(String desc)Sets the field descriptor. | 
| void | setName(String newName)Sets the field name. | 
| String | toString()Returns a string representation of the object. | 
public FieldInfo(ConstPool cp, String fieldName, String desc)
field_info structure.cp - a constant pool tablefieldName - field namedesc - field descriptorDescriptorpublic String toString()
public ConstPool getConstPool()
field_info.public String getName()
public void setName(String newName)
public int getAccessFlags()
AccessFlagpublic void setAccessFlags(int acc)
AccessFlagpublic String getDescriptor()
Descriptorpublic void setDescriptor(String desc)
Descriptorpublic int getConstantValue()
constant_pool table.public List getAttributes()
List object
 is shared with this object.  If you add a new attribute to the list,
 the attribute is also added to the field represented by this
 object.  If you remove an attribute from the list, it is also removed
 from the field.AttributeInfo objects.AttributeInfopublic AttributeInfo getAttribute(String name)
An attribute name can be obtained by, for example,
 AnnotationsAttribute.visibleTag or
 AnnotationsAttribute.invisibleTag. 
 
name - attribute namegetAttributes()public AttributeInfo removeAttribute(String name)
name - attribute name.public void addAttribute(AttributeInfo info)
getAttributes()Copyright © 2016 Shigeru Chiba, www.javassist.org. All Rights Reserved.