Package gnu.bytecode
Class Field
- java.lang.Object
-
- gnu.bytecode.Location
-
- gnu.bytecode.Field
-
- All Implemented Interfaces:
AttrContainer,Member
public class Field extends Location implements AttrContainer, Member
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends Annotation>
TgetAnnotation(Class<T> clas)AttributegetAttributes()Get the (first) Attribute of this container.ConstantPoolgetConstants()ClassTypegetDeclaringClass()intgetFlags()intgetModifiers()FieldgetNext()FieldgetReflectField()StringgetSourceName()booleangetStaticFlag()TypegetType()booleanhasConstantValueAttr()static FieldsearchField(Field fields, String name)Find a field with the given name.voidsetAttributes(Attribute attributes)Set the (list of) Attributes of this container.voidsetConstantValue(Object value, ClassType ctype)Set the ConstantValue attribute for this field.voidsetModifiers(int modifiers)voidsetSourceName(String name)voidsetStaticFlag(boolean is_static)StringtoString()-
Methods inherited from class gnu.bytecode.Location
getName, getSignature, setName, setName, setSignature, setType
-
-
-
-
Constructor Detail
-
Field
public Field(ClassType ctype)
Add a new Field to a ClassType.
-
-
Method Detail
-
getAttributes
public final Attribute getAttributes()
Description copied from interface:AttrContainerGet the (first) Attribute of this container.- Specified by:
getAttributesin interfaceAttrContainer
-
setAttributes
public final void setAttributes(Attribute attributes)
Description copied from interface:AttrContainerSet the (list of) Attributes of this container.- Specified by:
setAttributesin interfaceAttrContainer
-
getDeclaringClass
public final ClassType getDeclaringClass()
- Specified by:
getDeclaringClassin interfaceMember
-
getConstants
public final ConstantPool getConstants()
- Specified by:
getConstantsin interfaceAttrContainer
-
setStaticFlag
public final void setStaticFlag(boolean is_static)
-
getStaticFlag
public final boolean getStaticFlag()
- Specified by:
getStaticFlagin interfaceMember
-
getFlags
public final int getFlags()
-
getModifiers
public final int getModifiers()
- Specified by:
getModifiersin interfaceMember
-
setModifiers
public final void setModifiers(int modifiers)
-
getReflectField
public Field getReflectField() throws NoSuchFieldException
- Throws:
NoSuchFieldException
-
getAnnotation
public <T extends Annotation> T getAnnotation(Class<T> clas)
- Specified by:
getAnnotationin interfaceMember
-
setSourceName
public void setSourceName(String name)
-
getSourceName
public String getSourceName()
-
searchField
public static Field searchField(Field fields, String name)
Find a field with the given name.- Parameters:
fields- list of fields to searchname- (interned source) name of field to look for
-
getNext
public final Field getNext()
-
setConstantValue
public final void setConstantValue(Object value, ClassType ctype)
Set the ConstantValue attribute for this field.- Parameters:
value- the value to use for the ConstantValue attribute of this fieldctype- the class that contains this field This field's type is used to determine the kind of constant.
-
hasConstantValueAttr
public boolean hasConstantValueAttr()
-
-