Package serp.bytecode
Class BCField
java.lang.Object
serp.bytecode.Attributes
serp.bytecode.Annotated
serp.bytecode.BCMember
serp.bytecode.BCField
- All Implemented Interfaces:
BCEntity
,VisitAcceptor
A field of a class.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
acceptVisit
(BCVisitor visit) Accept a visit from aBCVisitor
, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this one.getConstantValue
(boolean add) Return the constant value information for the field.getType()
Return theClass
object for the type of this field.Return the bytecode for the type of this field.Return the name of the type of this field.(package private) void
initialize
(String name, String descriptor) Either this method orBCMember.read(java.io.DataInput)
must be called prior to use of this class.boolean
isEnum()
Manipulate the field access flags.boolean
Manipulate the field access flags.boolean
Manipulate the field access flags.boolean
Remove the constant value attribute for the field.void
setEnum
(boolean on) Manipulate the field access flags.void
setTransient
(boolean on) Manipulate the field access flags.void
Set the type of this field.void
Set the name of the type of this field.void
Set the type of this field.void
setVolatile
(boolean on) Manipulate the field access flags.Methods inherited from class serp.bytecode.BCMember
getAccessFlags, getAttributesHolder, getBCClass, getClassLoader, getDeclarer, getDescriptor, getDescriptorIndex, getName, getNameIndex, getPool, getProject, invalidate, isDeprecated, isFinal, isPackage, isPrivate, isProtected, isPublic, isStatic, isSynthetic, isValid, makePackage, makePrivate, makeProtected, makePublic, read, setAccessFlags, setDeprecated, setDescriptor, setDescriptorIndex, setFinal, setName, setNameIndex, setStatic, setSynthetic, write
Methods inherited from class serp.bytecode.Annotated
getDeclaredAnnotations, getDeclaredRuntimeAnnotations, removeDeclaredAnnotations, removeDeclaredRuntimeAnnotations
Methods inherited from class serp.bytecode.Attributes
addAttribute, addAttribute, clearAttributes, getAttribute, getAttributes, getAttributes, readAttributes, removeAttribute, removeAttribute, setAttributes, visitAttributes, writeAttributes
-
Constructor Details
-
BCField
BCField(BCClass owner)
-
-
Method Details
-
isVolatile
public boolean isVolatile()Manipulate the field access flags. -
setVolatile
public void setVolatile(boolean on) Manipulate the field access flags. -
isTransient
public boolean isTransient()Manipulate the field access flags. -
setTransient
public void setTransient(boolean on) Manipulate the field access flags. -
isEnum
public boolean isEnum()Manipulate the field access flags. Defaults to true for fields added to enum classes. -
setEnum
public void setEnum(boolean on) Manipulate the field access flags. Defaults to true for fields added to enum classes. -
getTypeName
Return the name of the type of this field. The name will be given in a form suitable for aClass.forName(java.lang.String)
call.- See Also:
-
getType
Return theClass
object for the type of this field. -
getTypeBC
Return the bytecode for the type of this field. -
setType
Set the name of the type of this field.- See Also:
-
setType
Set the type of this field.- See Also:
-
setType
Set the type of this field.- See Also:
-
getConstantValue
Return the constant value information for the field. Acts internally through theAttributes
interface.- Parameters:
add
- if true, a new constant value attribute will be added if not already present- Returns:
- the constant value information, or null if none and the
add
param is set to false
-
removeConstantValue
public boolean removeConstantValue()Remove the constant value attribute for the field. Acts internally through theAttributes
interface.- Returns:
- true if there was a value to remove
-
acceptVisit
Description copied from interface:VisitAcceptor
Accept a visit from aBCVisitor
, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this one.- Specified by:
acceptVisit
in interfaceVisitAcceptor
-
initialize
Description copied from class:BCMember
Either this method orBCMember.read(java.io.DataInput)
must be called prior to use of this class. The given descriptor must be in internal form.- Overrides:
initialize
in classBCMember
-