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);
javassist.CtField#getFieldInfo()
| Modifier and Type | Field and Description |
|---|---|
| pack-priv int | |
| pack-priv List | |
| pack-priv String | |
| pack-priv String | |
| pack-priv ConstPool | |
| pack-priv int | |
| pack-priv int |
| Access | Constructor and Description |
|---|---|
| private | |
| public | |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| pack-priv void | |
| public int | |
| public AttributeInfo | |
| public List | |
| public int | Returns: 0 if a ConstantValue attribute is not found.Finds a ConstantValue attribute and returns the index into
the |
| public ConstPool | |
| public String | |
| public String | |
| pack-priv void | |
| private void | |
| public AttributeInfo | Returns: the removed attribute or null.attribute name. name)Removes an attribute with the specified name. |
| public void | |
| public void | |
| public void | |
| public String | |
| pack-priv void |
| accessFlags | back to summary |
|---|---|
| pack-priv int accessFlags | |
| attribute | back to summary |
|---|---|
| pack-priv List<AttributeInfo> attribute | |
| cachedName | back to summary |
|---|---|
| pack-priv String cachedName | |
| cachedType | back to summary |
|---|---|
| pack-priv String cachedType | |
| constPool | back to summary |
|---|---|
| pack-priv ConstPool constPool | |
| descriptor | back to summary |
|---|---|
| pack-priv int descriptor | |
| name | back to summary |
|---|---|
| pack-priv int name | |
| FieldInfo | back to summary |
|---|---|
| private FieldInfo(ConstPool cp) | |
| FieldInfo | back to summary |
|---|---|
| public FieldInfo(ConstPool cp, String fieldName, String desc) Constructs a
| |
| FieldInfo | back to summary |
|---|---|
| pack-priv FieldInfo(ConstPool cp, DataInputStream in) throws IOException | |
| addAttribute | back to summary |
|---|---|
| public void addAttribute(AttributeInfo info) Appends an attribute. If there is already an attribute with the same name, the new one substitutes for it.
| |
| compact | back to summary |
|---|---|
| pack-priv void compact(ConstPool cp) Copies all constant pool items to a given new constant pool and replaces the original items with the new ones. This is used for garbage collecting the items of removed fields and methods.
| |
| getAccessFlags | back to summary |
|---|---|
| public int getAccessFlags() Returns the access flags.
| |
| getAttribute | back to summary |
|---|---|
| public AttributeInfo getAttribute(String name) Returns the attribute with the specified name. It returns null if the specified attribute is not found. An attribute name can be obtained by, for example,
| |
| getAttributes | back to summary |
|---|---|
| public List Returns all the attributes. The returned
| |
| getConstantValue | back to summary |
|---|---|
| public int getConstantValue() Finds a ConstantValue attribute and returns the index into
the
| |
| getConstPool | back to summary |
|---|---|
| public ConstPool getConstPool() Returns the constant pool table used
by this | |
| getDescriptor | back to summary |
|---|---|
| public String getDescriptor() Returns the field descriptor.
| |
| getName | back to summary |
|---|---|
| public String getName() Returns the field name. | |
| prune | back to summary |
|---|---|
| pack-priv void prune(ConstPool cp) | |
| read | back to summary |
|---|---|
| private void read(DataInputStream in) throws IOException | |
| removeAttribute | back to summary |
|---|---|
| public AttributeInfo removeAttribute(String name) Removes an attribute with the specified name.
| |
| setAccessFlags | back to summary |
|---|---|
| public void setAccessFlags(int acc) Sets the access flags.
| |
| setDescriptor | back to summary |
|---|---|
| public void setDescriptor(String desc) Sets the field descriptor.
| |
| setName | back to summary |
|---|---|
| public void setName(String newName) Sets the field name. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns a string representation of the object.
| |
| write | back to summary |
|---|---|
| pack-priv void write(DataOutputStream out) throws IOException | |