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)
Attribute
getAttributes()
Get the (first) Attribute of this container.ConstantPool
getConstants()
ClassType
getDeclaringClass()
int
getFlags()
int
getModifiers()
Field
getNext()
Field
getReflectField()
String
getSourceName()
boolean
getStaticFlag()
Type
getType()
boolean
hasConstantValueAttr()
static Field
searchField(Field fields, String name)
Find a field with the given name.void
setAttributes(Attribute attributes)
Set the (list of) Attributes of this container.void
setConstantValue(Object value, ClassType ctype)
Set the ConstantValue attribute for this field.void
setModifiers(int modifiers)
void
setSourceName(String name)
void
setStaticFlag(boolean is_static)
String
toString()
-
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:AttrContainer
Get the (first) Attribute of this container.- Specified by:
getAttributes
in interfaceAttrContainer
-
setAttributes
public final void setAttributes(Attribute attributes)
Description copied from interface:AttrContainer
Set the (list of) Attributes of this container.- Specified by:
setAttributes
in interfaceAttrContainer
-
getDeclaringClass
public final ClassType getDeclaringClass()
- Specified by:
getDeclaringClass
in interfaceMember
-
getConstants
public final ConstantPool getConstants()
- Specified by:
getConstants
in interfaceAttrContainer
-
setStaticFlag
public final void setStaticFlag(boolean is_static)
-
getStaticFlag
public final boolean getStaticFlag()
- Specified by:
getStaticFlag
in interfaceMember
-
getFlags
public final int getFlags()
-
getModifiers
public final int getModifiers()
- Specified by:
getModifiers
in 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:
getAnnotation
in 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()
-
-