Modifier and Type | Field and Description |
---|---|
static int |
ACC_ENUM
This field represents ACC_ENUM in the access_flags element of a field_info structure.
|
static int |
ACC_FINAL
This field represents ACC_FINAL in the access_flags element of a field_info structure.
|
static int |
ACC_PRIVATE
This field represents ACC_PRIVATE in the access_flags element of a field_info structure.
|
static int |
ACC_PROTECTED
This field represents ACC_PROTECTED in the access_flags element of a field_info structure.
|
static int |
ACC_PUBLIC
This field represents ACC_PUBLIC in the access_flags element of a field_info structure.
|
static int |
ACC_STATIC
This field represents ACC_STATIC in the access_flags element of a field_info structure.
|
static int |
ACC_SYNTHETIC
This field represents ACC_SYNTHETIC in the access_flags element of a field_info structure.
|
static int |
ACC_TRANSIENT
This field represents ACC_TRANSIENT in the access_flags element of a field_info structure.
|
static int |
ACC_VOLATILE
This field represents ACC_VOLATILE in the access_flags element of a field_info structure.
|
Constructor and Description |
---|
FieldInfo()
Constructs a new
FieldInfo instance. |
Modifier and Type | Method and Description |
---|---|
boolean |
accept(NodeHierarchicalVisitor nodeHierarchicalVisitor)
Accepts a
NodeHierarchicalVisitor . |
boolean |
addAttributeInfo(AttributeInfo attributeInfo)
Adds
attributeInfo to this FieldInfo instance, if absent. |
boolean |
containsAttributeInfo(AttributeInfo attributeInfo)
Returns
true if, and only if, this FieldInfo instance contains attributeInfo , false otherwise. |
FieldInfo |
copy()
Returns a copy of this
FieldInfo instance. |
boolean |
equals(java.lang.Object object)
Compares
object to this FieldInfo instance for equality. |
int |
getAccessFlags()
Returns the access_flags of this
FieldInfo instance. |
AttributeInfo |
getAttributeInfo(AttributeInfo attributeInfo)
|
AttributeInfo |
getAttributeInfo(int index)
Returns an
AttributeInfo given its index. |
int |
getAttributeInfoCount()
Returns the number of
AttributeInfo s currently added. |
java.util.List<AttributeInfo> |
getAttributeInfos()
Returns a
List with all currently added AttributeInfo s. |
int |
getDescriptorIndex()
Returns the descriptor_index of this
FieldInfo instance. |
int |
getNameIndex()
Returns the name_index of this
FieldInfo instance. |
int |
hashCode()
Returns a hash code for this
FieldInfo instance. |
boolean |
isClassCompatible()
Returns
true if, and only if, this FieldInfo instance may be used in a class, false otherwise. |
boolean |
isEnum()
Returns
true if, and only if, ACC_ENUM is set in the access_flags item of this FieldInfo instance, false otherwise. |
boolean |
isFinal()
Returns
true if, and only if, ACC_FINAL is set in the access_flags item of this FieldInfo instance, false otherwise. |
boolean |
isInterfaceCompatible()
Returns
true if, and only if, this FieldInfo instance may be used in an interface, false otherwise. |
boolean |
isPrivate()
Returns
true if, and only if, ACC_PRIVATE is set in the access_flags item of this FieldInfo instance, false otherwise. |
boolean |
isProtected()
Returns
true if, and only if, ACC_PROTECTED is set in the access_flags item of this FieldInfo instance, false otherwise. |
boolean |
isPublic()
Returns
true if, and only if, ACC_PUBLIC is set in the access_flags item of this FieldInfo instance, false otherwise. |
boolean |
isStatic()
Returns
true if, and only if, ACC_STATIC is set in the access_flags item of this FieldInfo instance, false otherwise. |
boolean |
isSynthetic()
Returns
true if, and only if, ACC_SYNTHETIC is set in the access_flags item of this FieldInfo instance, false otherwise. |
boolean |
isTransient()
Returns
true if, and only if, ACC_TRANSIENT is set in the access_flags item of this FieldInfo instance, false otherwise. |
boolean |
isVolatile()
Returns
true if, and only if, ACC_VOLATILE is set in the access_flags item of this FieldInfo instance, false otherwise. |
static FieldInfo |
newInstance()
Returns a new
FieldInfo instance. |
boolean |
removeAttributeInfo(AttributeInfo attributeInfo)
Removes
attributeInfo from this FieldInfo instance, if present. |
void |
setDescriptorIndex(int descriptorIndex)
Sets a new descriptor_index for this
FieldInfo instance. |
void |
setEnum(boolean isEnum)
Adds or removes the access flag ACC_ENUM.
|
void |
setFinal(boolean isFinal)
Adds or removes the access flag ACC_FINAL.
|
void |
setNameIndex(int nameIndex)
Sets a new name_index for this
FieldInfo instance. |
void |
setPrivate(boolean isPrivate)
Adds or removes the access flag ACC_PRIVATE.
|
void |
setProtected(boolean isProtected)
Adds or removes the access flag ACC_PROTECTED.
|
void |
setPublic(boolean isPublic)
Adds or removes the access flag ACC_PUBLIC.
|
void |
setStatic(boolean isStatic)
Adds or removes the access flag ACC_STATIC.
|
void |
setSynthetic(boolean isSynthetic)
Adds or removes the access flag ACC_SYNTHETIC.
|
void |
setTransient(boolean isTransient)
Adds or removes the access flag ACC_TRANSIENT.
|
void |
setVolatile(boolean isVolatile)
Adds or removes the access flag ACC_VOLATILE.
|
java.lang.String |
toString()
Returns a
String representation of this FieldInfo instance. |
Document |
write()
Writes this
FieldInfo to a Document . |
java.io.DataOutput |
write(java.io.DataOutput dataOutput)
Writes this
FieldInfo to dataOutput . |
Document |
write(Document document)
Writes this
FieldInfo to document . |
public static final int ACC_ENUM
public static final int ACC_FINAL
public static final int ACC_PRIVATE
public static final int ACC_PROTECTED
public static final int ACC_PUBLIC
public static final int ACC_STATIC
public static final int ACC_SYNTHETIC
public static final int ACC_TRANSIENT
public static final int ACC_VOLATILE
public AttributeInfo getAttributeInfo(AttributeInfo attributeInfo)
AttributeInfo
instance of this FieldInfo
instance that is equal to attributeInfo
.
If attributeInfo
is null
, a NullPointerException
will be thrown.
If this FieldInfo
instance does not contain an AttributeInfo
instance that is equal to attributeInfo
, an IllegalArgumentException
will be thrown.
attributeInfo
- the AttributeInfo
instance to test for equality againstAttributeInfo
instance of this FieldInfo
instance that is equal to attributeInfo
java.lang.IllegalArgumentException
- thrown if, and only if, this FieldInfo
instance does not contain an AttributeInfo
instance that is equal to attributeInfo
java.lang.NullPointerException
- thrown if, and only if, attributeInfo
is null
public AttributeInfo getAttributeInfo(int index)
AttributeInfo
given its index.
If index
is less than 0
, or greater than or equal to getAttributeInfoCount()
, an IndexOutOfBoundsException
will be thrown.
index
- the index of the AttributeInfo
AttributeInfo
given its indexjava.lang.IndexOutOfBoundsException
- thrown if, and only if, index
is less than 0
, or greater than or equal to getAttributeInfoCount()
public java.io.DataOutput write(java.io.DataOutput dataOutput)
FieldInfo
to dataOutput
.
Returns dataOutput
.
If dataOutput
is null
, a NullPointerException
will be thrown.
If an IOException
is caught, an UncheckedIOException
will be thrown.
This method does not close dataOutput
.
dataOutput
- the DataOutput
to write todataOutput
java.lang.NullPointerException
- thrown if, and only if, dataOutput
is null
java.io.UncheckedIOException
- thrown if, and only if, an IOException
is caughtpublic Document write()
FieldInfo
to a Document
.
Returns the Document
.
Calling this method is equivalent to the following:
fieldInfo.write(new Document());
Document
public Document write(Document document)
FieldInfo
to document
.
Returns document
.
If document
is null
, a NullPointerException
will be thrown.
document
- the Document
to write todocument
java.lang.NullPointerException
- thrown if, and only if, document
is null
public FieldInfo copy()
FieldInfo
instance.FieldInfo
instancepublic java.util.List<AttributeInfo> getAttributeInfos()
List
with all currently added AttributeInfo
s.
Modifying the returned List
will not affect this FieldInfo
instance.
List
with all currently added AttributeInfo
spublic java.lang.String toString()
String
representation of this FieldInfo
instance.toString
in class java.lang.Object
String
representation of this FieldInfo
instancepublic boolean accept(NodeHierarchicalVisitor nodeHierarchicalVisitor)
NodeHierarchicalVisitor
.
Returns the result of nodeHierarchicalVisitor.visitLeave(this)
.
If nodeHierarchicalVisitor
is null
, a NullPointerException
will be thrown.
If a RuntimeException
is thrown by the current NodeHierarchicalVisitor
, a NodeTraversalException
will be thrown with the RuntimeException
wrapped.
This implementation will:
NullPointerException
if nodeHierarchicalVisitor
is null
.NodeTraversalException
if nodeHierarchicalVisitor
throws a RuntimeException
.Node
s, if it has any.accept
in interface Node
nodeHierarchicalVisitor
- the NodeHierarchicalVisitor
to acceptnodeHierarchicalVisitor.visitLeave(this)
NodeTraversalException
- thrown if, and only if, a RuntimeException
is thrown by the current NodeHierarchicalVisitor
java.lang.NullPointerException
- thrown if, and only if, nodeHierarchicalVisitor
is null
public boolean addAttributeInfo(AttributeInfo attributeInfo)
attributeInfo
to this FieldInfo
instance, if absent.
Returns true
if, and only if, attributeInfo
was added, false
otherwise.
If attributeInfo
is null
, a NullPointerException
will be thrown.
attributeInfo
- the AttributeInfo
to addtrue
if, and only if, attributeInfo
was added, false
otherwisejava.lang.NullPointerException
- thrown if, and only if, attributeInfo
is null
public boolean containsAttributeInfo(AttributeInfo attributeInfo)
true
if, and only if, this FieldInfo
instance contains attributeInfo
, false
otherwise.
If attributeInfo
is null
, a NullPointerException
will be thrown.
attributeInfo
- the AttributeInfo
to checktrue
if, and only if, this FieldInfo
instance contains attributeInfo
, false
otherwisejava.lang.NullPointerException
- thrown if, and only if, attributeInfo
is null
public boolean equals(java.lang.Object object)
object
to this FieldInfo
instance for equality.
Returns true
if, and only if, object
is an instance of FieldInfo
, and their respective values are equal, false
otherwise.
equals
in class java.lang.Object
object
- the Object
to compare to this FieldInfo
instance for equalitytrue
if, and only if, object
is an instance of FieldInfo
, and their respective values are equal, false
otherwisepublic boolean isClassCompatible()
true
if, and only if, this FieldInfo
instance may be used in a class, false
otherwise.
This method should always return true
. This is because, any and all of the access flag mutator methods will take care of their own constraints, such that an instance of this class will always be in a valid
state. A class may have any access flag, but not all combinations thereof.
true
if, and only if, this FieldInfo
instance may be used in a class, false
otherwisepublic boolean isEnum()
true
if, and only if, ACC_ENUM is set in the access_flags item of this FieldInfo
instance, false
otherwise.true
if, and only if, ACC_ENUM is set in the access_flags item of this FieldInfo
instance, false
otherwisepublic boolean isFinal()
true
if, and only if, ACC_FINAL is set in the access_flags item of this FieldInfo
instance, false
otherwise.true
if, and only if, ACC_FINAL is set in the access_flags item of this FieldInfo
instance, false
otherwisepublic boolean isInterfaceCompatible()
true
if, and only if, this FieldInfo
instance may be used in an interface, false
otherwise.
In order for this method to return true
, all of the methods isFinal()
, isPublic()
and isStatic()
must return true
. The method isSynthetic()
may return true
,
but this is not a requirement. All the other methods, namely isEnum()
, isPrivate()
, isProtected()
, isTransient()
and isVolatile()
, must return false
.
true
if, and only if, this FieldInfo
instance may be used in an interface, false
otherwisepublic boolean isPrivate()
true
if, and only if, ACC_PRIVATE is set in the access_flags item of this FieldInfo
instance, false
otherwise.true
if, and only if, ACC_PRIVATE is set in the access_flags item of this FieldInfo
instance, false
otherwisepublic boolean isProtected()
true
if, and only if, ACC_PROTECTED is set in the access_flags item of this FieldInfo
instance, false
otherwise.true
if, and only if, ACC_PROTECTED is set in the access_flags item of this FieldInfo
instance, false
otherwisepublic boolean isPublic()
true
if, and only if, ACC_PUBLIC is set in the access_flags item of this FieldInfo
instance, false
otherwise.true
if, and only if, ACC_PUBLIC is set in the access_flags item of this FieldInfo
instance, false
otherwisepublic boolean isStatic()
true
if, and only if, ACC_STATIC is set in the access_flags item of this FieldInfo
instance, false
otherwise.true
if, and only if, ACC_STATIC is set in the access_flags item of this FieldInfo
instance, false
otherwisepublic boolean isSynthetic()
true
if, and only if, ACC_SYNTHETIC is set in the access_flags item of this FieldInfo
instance, false
otherwise.true
if, and only if, ACC_SYNTHETIC is set in the access_flags item of this FieldInfo
instance, false
otherwisepublic boolean isTransient()
true
if, and only if, ACC_TRANSIENT is set in the access_flags item of this FieldInfo
instance, false
otherwise.true
if, and only if, ACC_TRANSIENT is set in the access_flags item of this FieldInfo
instance, false
otherwisepublic boolean isVolatile()
true
if, and only if, ACC_VOLATILE is set in the access_flags item of this FieldInfo
instance, false
otherwise.true
if, and only if, ACC_VOLATILE is set in the access_flags item of this FieldInfo
instance, false
otherwisepublic boolean removeAttributeInfo(AttributeInfo attributeInfo)
attributeInfo
from this FieldInfo
instance, if present.
Returns true
if, and only if, attributeInfo
was removed, false
otherwise.
If attributeInfo
is null
, a NullPointerException
will be thrown.
attributeInfo
- the AttributeInfo
to removetrue
if, and only if, attributeInfo
was removed, false
otherwisejava.lang.NullPointerException
- thrown if, and only if, attributeInfo
is null
public int getAccessFlags()
FieldInfo
instance.FieldInfo
instancepublic int getAttributeInfoCount()
AttributeInfo
s currently added.AttributeInfo
s currently addedpublic int getDescriptorIndex()
FieldInfo
instance.FieldInfo
instancepublic int getNameIndex()
FieldInfo
instance.FieldInfo
instancepublic int hashCode()
FieldInfo
instance.hashCode
in class java.lang.Object
FieldInfo
instancepublic void setDescriptorIndex(int descriptorIndex)
FieldInfo
instance.
If descriptorIndex
is less than or equal to 0
, an IllegalArgumentException
will be thrown.
descriptorIndex
- the new descriptor_index for this FieldInfo
instancejava.lang.IllegalArgumentException
- thrown if, and only if, descriptorIndex
is less than or equal to 0
public void setEnum(boolean isEnum)
isEnum
- true
to add the access flag ACC_ENUMpublic void setFinal(boolean isFinal)
This method turns off the following access flags, if given a parameter argument that is set to true
:
isFinal
- true
to add the access flag ACC_FINALpublic void setNameIndex(int nameIndex)
FieldInfo
instance.
If nameIndex
is less than or equal to 0
, an IllegalArgumentException
will be thrown.
nameIndex
- the new name_index for this FieldInfo
instancejava.lang.IllegalArgumentException
- thrown if, and only if, nameIndex
is less than or equal to 0
public void setPrivate(boolean isPrivate)
This method turns off the following access flags, if given a parameter argument that is set to true
:
isPrivate
- true
to add the access flag ACC_PRIVATEpublic void setProtected(boolean isProtected)
This method turns off the following access flags, if given a parameter argument that is set to true
:
isProtected
- true
to add the access flag ACC_PROTECTEDpublic void setPublic(boolean isPublic)
This method turns off the following access flags, if given a parameter argument that is set to true
:
isPublic
- true
to add the access flag ACC_PUBLICpublic void setStatic(boolean isStatic)
isStatic
- true
to add the access flag ACC_STATICpublic void setSynthetic(boolean isSynthetic)
isSynthetic
- true
to add the access flag ACC_SYNTHETICpublic void setTransient(boolean isTransient)
isTransient
- true
to add the access flag ACC_TRANSIENTpublic void setVolatile(boolean isVolatile)
This method turns off the following access flags, if given a parameter argument that is set to true
:
isVolatile
- true
to add the access flag ACC_VOLATILEpublic static FieldInfo newInstance()
FieldInfo
instance.FieldInfo
instance