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 java.lang.annotation.Annotation>
TgetAnnotation(java.lang.Class<T> clas)AttributegetAttributes()Get the (first) Attribute of this container.ConstantPoolgetConstants()ClassTypegetDeclaringClass()intgetFlags()intgetModifiers()FieldgetNext()java.lang.reflect.FieldgetReflectField()java.lang.StringgetSourceName()booleangetStaticFlag()TypegetType()booleanhasConstantValueAttr()static FieldsearchField(Field fields, java.lang.String name)Find a field with the given name.voidsetAttributes(Attribute attributes)Set the (list of) Attributes of this container.voidsetConstantValue(java.lang.Object value, ClassType ctype)Set the ConstantValue attribute for this field.voidsetModifiers(int modifiers)voidsetSourceName(java.lang.String name)voidsetStaticFlag(boolean is_static)java.lang.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 java.lang.reflect.Field getReflectField() throws java.lang.NoSuchFieldException- Throws:
java.lang.NoSuchFieldException
-
getAnnotation
public <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.Class<T> clas)
- Specified by:
getAnnotationin interfaceMember
-
setSourceName
public void setSourceName(java.lang.String name)
-
getSourceName
public java.lang.String getSourceName()
-
searchField
public static Field searchField(Field fields, java.lang.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(java.lang.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()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-