public final class ConstantUTF8Info extends CPInfo
ConstantUTF8Info
denotes a CONSTANT_Utf8_info structure in the constant_pool of a ClassFile structure.
The CONSTANT_Utf8_info structure was added to Java in version 1.0.2.
This class is not thread-safe.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME
The name of the CONSTANT_Utf8_info structure.
|
static int |
TAG
The tag for CONSTANT_Utf8.
|
Modifier and Type | Method and Description |
---|---|
ConstantUTF8Info |
copy()
Returns a copy of this
ConstantUTF8Info instance. |
boolean |
equals(java.lang.Object object)
Returns
true if, and only if, object is an instance of ConstantUTF8Info , and that ConstantUTF8Info instance is equal to this ConstantUTF8Info instance, false otherwise. |
static java.util.List<ConstantUTF8Info> |
filter(Node node)
Returns a
List with all ConstantUTF8Info s. |
static ConstantUTF8Info |
findByAttributeNameIndex(AttributeInfo attributeInfo,
ClassFile classFile)
Returns the
ConstantUTF8Info that is located on the index attributeInfo.getAttributeNameIndex() in the constant_pool table of classFile . |
static ConstantUTF8Info |
findByAttributeNameIndex(AttributeInfo attributeInfo,
ClassFile classFile,
FieldInfo fieldInfo)
Returns the
ConstantUTF8Info that is located on the index attributeInfo.getAttributeNameIndex() in the constant_pool table of classFile . |
static ConstantUTF8Info |
findByAttributeNameIndex(AttributeInfo attributeInfo,
ClassFile classFile,
MethodInfo methodInfo)
Returns the
ConstantUTF8Info that is located on the index attributeInfo.getAttributeNameIndex() in the constant_pool table of classFile . |
static ConstantUTF8Info |
findByDescriptorIndex(ClassFile classFile,
FieldInfo fieldInfo)
Returns the
ConstantUTF8Info that is located on the index fieldInfo.getDescriptorIndex() in the constant_pool table of classFile . |
static ConstantUTF8Info |
findByDescriptorIndex(ClassFile classFile,
MethodInfo methodInfo)
Returns the
ConstantUTF8Info that is located on the index methodInfo.getDescriptorIndex() in the constant_pool table of classFile . |
static ConstantUTF8Info |
findByNameIndex(ClassFile classFile,
FieldInfo fieldInfo)
Returns the
ConstantUTF8Info that is located on the index fieldInfo.getNameIndex() in the constant_pool table of classFile . |
static ConstantUTF8Info |
findByNameIndex(ClassFile classFile,
MethodInfo methodInfo)
Returns the
ConstantUTF8Info that is located on the index methodInfo.getNameIndex() in the constant_pool table of classFile . |
static ConstantUTF8Info |
findByStringIndex(ClassFile classFile,
ConstantStringInfo constantStringInfo)
Returns the
ConstantUTF8Info that is located on the index constantStringInfo.getStringIndex() in the constant_pool table of classFile . |
java.lang.String |
getString()
Returns the
String currently assigned to this ConstantUTF8Info instance. |
int |
hashCode()
Returns a hash code for this
ConstantUTF8Info instance. |
static NodeFilter |
newAnyNodeFilter()
|
static ConstantUTF8Info |
newInstance(java.lang.String string)
Returns a new
ConstantUTF8Info . |
static NodeFilter |
newRegexNodeFilter(java.lang.String regex)
Returns a
NodeFilter that accepts Node s that are instances of ConstantUTF8Info and have a getString() method that matches regex . |
void |
setString(java.lang.String string)
Sets a new
String representation for this ConstantUTF8Info instance. |
java.lang.String |
toString()
Returns a
String representation of this ConstantUTF8Info instance. |
void |
write(java.io.DataOutput dataOutput)
Writes this
ConstantUTF8Info to dataOutput . |
void |
write(Document document)
Writes this
ConstantUTF8Info to document . |
getConstantPoolEntryCount, getName, getTag
public static final java.lang.String NAME
public static final int TAG
public ConstantUTF8Info copy()
ConstantUTF8Info
instance.public java.lang.String getString()
String
currently assigned to this ConstantUTF8Info
instance.String
currently assigned to this ConstantUTF8Info
instancepublic java.lang.String toString()
String
representation of this ConstantUTF8Info
instance.toString
in class java.lang.Object
String
representation of this ConstantUTF8Info
instancepublic boolean equals(java.lang.Object object)
true
if, and only if, object
is an instance of ConstantUTF8Info
, and that ConstantUTF8Info
instance is equal to this ConstantUTF8Info
instance, false
otherwise.equals
in class java.lang.Object
object
- an Object
to compare to this ConstantUTF8Info
instance for equalitytrue
if, and only if, object
is an instance of ConstantUTF8Info
, and that ConstantUTF8Info
instance is equal to this ConstantUTF8Info
instance, false
otherwisepublic int hashCode()
ConstantUTF8Info
instance.hashCode
in class java.lang.Object
ConstantUTF8Info
instancepublic void setString(java.lang.String string)
String
representation for this ConstantUTF8Info
instance.
If string
is null
, a NullPointerException
will be thrown.
string
- the new String
representationjava.lang.NullPointerException
- thrown if, and only if, string
is null
public void write(java.io.DataOutput dataOutput)
ConstantUTF8Info
to dataOutput
.
If dataOutput
is an OutputStream
(or any other type of stream), this method will not close it.
If dataOutput
is null
, a NullPointerException
will be thrown.
If an I/O-error occurs, an UncheckedIOException
will be thrown.
public void write(Document document)
ConstantUTF8Info
to document
.
If document
is null
, a NullPointerException
may be thrown. But no guarantees can be made.
public static ConstantUTF8Info findByAttributeNameIndex(AttributeInfo attributeInfo, ClassFile classFile)
ConstantUTF8Info
that is located on the index attributeInfo.getAttributeNameIndex()
in the constant_pool table of classFile
.
If either attributeInfo
or classFile
are null
, a NullPointerException
will be thrown.
If classFile
does not contain an AttributeInfo
instance that is equal to attributeInfo
, or the CPInfo
on the index attribute_name_index is not a ConstantUTF8Info
instance, an
IllegalArgumentException
will be thrown.
If attribute_name_index is less than 0
, or greater than or equal to classFile.getCPInfoCount()
, an IndexOutOfBoundsException
will be thrown.
attributeInfo
- the AttributeInfo
instance that contains the attribute_name_indexclassFile
- the ClassFile
instance that contains an AttributeInfo
instance that is equal to attributeInfo
ConstantUTF8Info
that is located on the index attributeInfo.getAttributeNameIndex()
in the constant_pool table of classFile
java.lang.IllegalArgumentException
- thrown if, and only if, classFile
does not contain an AttributeInfo
instance that is equal to attributeInfo
, or the CPInfo
on the index attribute_name_index is not a
ConstantUTF8Info
instancejava.lang.IndexOutOfBoundsException
- thrown if, and only if, attribute_name_index is less than 0
, or greater than or equal to classFile.getCPInfoCount()
java.lang.NullPointerException
- thrown if, and only if, either attributeInfo
or classFile
are null
public static ConstantUTF8Info findByAttributeNameIndex(AttributeInfo attributeInfo, ClassFile classFile, FieldInfo fieldInfo)
ConstantUTF8Info
that is located on the index attributeInfo.getAttributeNameIndex()
in the constant_pool table of classFile
.
If either attributeInfo
, classFile
or fieldInfo
are null
, a NullPointerException
will be thrown.
If classFile
does not contain a FieldInfo
instance that is equal to fieldInfo
, fieldInfo
does not contain an AttributeInfo
instance that is equal to attributeInfo
, or the CPInfo
on the
index attribute_name_index is not a ConstantUTF8Info
instance, an IllegalArgumentException
will be thrown.
If attribute_name_index is less than 0
, or greater than or equal to classFile.getCPInfoCount()
, an IndexOutOfBoundsException
will be thrown.
attributeInfo
- the AttributeInfo
instance that contains the attribute_name_indexclassFile
- the ClassFile
instance that contains a FieldInfo
instance that is equal to fieldInfo
fieldInfo
- the FieldInfo
instance that contains an AttributeInfo
instance that is equal to attributeInfo
ConstantUTF8Info
that is located on the index attributeInfo.getAttributeNameIndex()
in the constant_pool table of classFile
java.lang.IllegalArgumentException
- thrown if, and only if, classFile
does not contain a FieldInfo
instance that is equal to fieldInfo
, fieldInfo
does not contain an AttributeInfo
instance that is equal to
attributeInfo
, or the CPInfo
on the index attribute_name_index is not a ConstantUTF8Info
instancejava.lang.IndexOutOfBoundsException
- thrown if, and only if, attribute_name_index is less than 0
, or greater than or equal to classFile.getCPInfoCount()
java.lang.NullPointerException
- thrown if, and only if, either attributeInfo
, classFile
or fieldInfo
are null
public static ConstantUTF8Info findByAttributeNameIndex(AttributeInfo attributeInfo, ClassFile classFile, MethodInfo methodInfo)
ConstantUTF8Info
that is located on the index attributeInfo.getAttributeNameIndex()
in the constant_pool table of classFile
.
If either attributeInfo
, classFile
or methodInfo
are null
, a NullPointerException
will be thrown.
If classFile
does not contain a MethodInfo
instance that is equal to methodInfo
, methodInfo
does not contain an AttributeInfo
instance that is equal to attributeInfo
, or the CPInfo
on the
index attribute_name_index is not a ConstantUTF8Info
instance, an IllegalArgumentException
will be thrown.
If attribute_name_index is less than 0
, or greater than or equal to classFile.getCPInfoCount()
, an IndexOutOfBoundsException
will be thrown.
attributeInfo
- the AttributeInfo
instance that contains the attribute_name_indexclassFile
- the ClassFile
instance that contains a MethodInfo
instance that is equal to methodInfo
methodInfo
- the MethodInfo
instance that contains an AttributeInfo
instance that is equal to attributeInfo
ConstantUTF8Info
that is located on the index attributeInfo.getAttributeNameIndex()
in the constant_pool table of classFile
java.lang.IllegalArgumentException
- thrown if, and only if, classFile
does not contain a MethodInfo
instance that is equal to methodInfo
, methodInfo
does not contain an AttributeInfo
instance that is equal
to attributeInfo
, or the CPInfo
on the index attribute_name_index is not a ConstantUTF8Info
instancejava.lang.IndexOutOfBoundsException
- thrown if, and only if, attribute_name_index is less than 0
, or greater than or equal to classFile.getCPInfoCount()
java.lang.NullPointerException
- thrown if, and only if, either attributeInfo
, classFile
or methodInfo
are null
public static ConstantUTF8Info findByDescriptorIndex(ClassFile classFile, FieldInfo fieldInfo)
ConstantUTF8Info
that is located on the index fieldInfo.getDescriptorIndex()
in the constant_pool table of classFile
.
If either classFile
or fieldInfo
are null
, a NullPointerException
will be thrown.
If classFile
does not contain a FieldInfo
instance that is equal to fieldInfo
, or the CPInfo
on the index descriptor_index is not a ConstantUTF8Info
instance, an IllegalArgumentException
will be
thrown.
If descriptor_index is less than 0
, or greater than or equal to classFile.getCPInfoCount()
, an IndexOutOfBoundsException
will be thrown.
classFile
- the ClassFile
instance that contains a FieldInfo
instance that is equal to fieldInfo
fieldInfo
- the FieldInfo
instance that contains the descriptor_indexConstantUTF8Info
that is located on the index fieldInfo.getDescriptorIndex()
in the constant_pool table of classFile
java.lang.IllegalArgumentException
- thrown if, and only if, classFile
does not contain a FieldInfo
instance that is equal to fieldInfo
, or the CPInfo
on the index descriptor_index is not a ConstantUTF8Info
instancejava.lang.IndexOutOfBoundsException
- thrown if, and only if, descriptor_index is less than 0
, or greater than or equal to classFile.getCPInfoCount()
java.lang.NullPointerException
- thrown if, and only if, either classFile
or fieldInfo
are null
public static ConstantUTF8Info findByDescriptorIndex(ClassFile classFile, MethodInfo methodInfo)
ConstantUTF8Info
that is located on the index methodInfo.getDescriptorIndex()
in the constant_pool table of classFile
.
If either classFile
or methodInfo
are null
, a NullPointerException
will be thrown.
If classFile
does not contain a MethodInfo
instance that is equal to methodInfo
, or the CPInfo
on the index descriptor_index is not a ConstantUTF8Info
instance, an IllegalArgumentException
will be
thrown.
If descriptor_index is less than 0
, or greater than or equal to classFile.getCPInfoCount()
, an IndexOutOfBoundsException
will be thrown.
classFile
- the ClassFile
instance that contains a MethodInfo
instance that is equal to methodInfo
methodInfo
- the MethodInfo
instance that contains the descriptor_indexConstantUTF8Info
that is located on the index methodInfo.getDescriptorIndex()
in the constant_pool table of classFile
java.lang.IllegalArgumentException
- thrown if, and only if, classFile
does not contain a MethodInfo
instance that is equal to methodInfo
, or the CPInfo
on the index descriptor_index is not a ConstantUTF8Info
instancejava.lang.IndexOutOfBoundsException
- thrown if, and only if, descriptor_index is less than 0
, or greater than or equal to classFile.getCPInfoCount()
java.lang.NullPointerException
- thrown if, and only if, either classFile
or methodInfo
are null
public static ConstantUTF8Info findByNameIndex(ClassFile classFile, FieldInfo fieldInfo)
ConstantUTF8Info
that is located on the index fieldInfo.getNameIndex()
in the constant_pool table of classFile
.
If either classFile
or fieldInfo
are null
, a NullPointerException
will be thrown.
If classFile
does not contain a FieldInfo
instance that is equal to fieldInfo
, or the CPInfo
on the index name_index is not a ConstantUTF8Info
instance, an IllegalArgumentException
will be thrown.
If name_index is less than 0
, or greater than or equal to classFile.getCPInfoCount()
, an IndexOutOfBoundsException
will be thrown.
classFile
- the ClassFile
instance that contains a FieldInfo
instance that is equal to fieldInfo
fieldInfo
- the FieldInfo
instance that contains the name_indexConstantUTF8Info
that is located on the index fieldInfo.getNameIndex()
in the constant_pool table of classFile
java.lang.IllegalArgumentException
- thrown if, and only if, classFile
does not contain a FieldInfo
instance that is equal to fieldInfo
, or the CPInfo
on the index name_index is not a ConstantUTF8Info
instancejava.lang.IndexOutOfBoundsException
- thrown if, and only if, name_index is less than 0
, or greater than or equal to classFile.getCPInfoCount()
java.lang.NullPointerException
- thrown if, and only if, either classFile
or fieldInfo
are null
public static ConstantUTF8Info findByNameIndex(ClassFile classFile, MethodInfo methodInfo)
ConstantUTF8Info
that is located on the index methodInfo.getNameIndex()
in the constant_pool table of classFile
.
If either classFile
or methodInfo
are null
, a NullPointerException
will be thrown.
If classFile
does not contain a MethodInfo
instance that is equal to methodInfo
, or the CPInfo
on the index name_index is not a ConstantUTF8Info
instance, an IllegalArgumentException
will be
thrown.
If name_index is less than 0
, or greater than or equal to classFile.getCPInfoCount()
, an IndexOutOfBoundsException
will be thrown.
classFile
- the ClassFile
instance that contains a MethodInfo
instance that is equal to methodInfo
methodInfo
- the MethodInfo
instance that contains the name_indexConstantUTF8Info
that is located on the index methodInfo.getNameIndex()
in the constant_pool table of classFile
java.lang.IllegalArgumentException
- thrown if, and only if, classFile
does not contain a MethodInfo
instance that is equal to methodInfo
, or the CPInfo
on the index name_index is not a ConstantUTF8Info
instancejava.lang.IndexOutOfBoundsException
- thrown if, and only if, name_index is less than 0
, or greater than or equal to classFile.getCPInfoCount()
java.lang.NullPointerException
- thrown if, and only if, either classFile
or methodInfo
are null
public static ConstantUTF8Info findByStringIndex(ClassFile classFile, ConstantStringInfo constantStringInfo)
ConstantUTF8Info
that is located on the index constantStringInfo.getStringIndex()
in the constant_pool table of classFile
.
If either classFile
or constantStringInfo
are null
, a NullPointerException
will be thrown.
If classFile
does not contain a ConstantStringInfo
instance that is equal to constantStringInfo
, or the CPInfo
on the index string_index is not a ConstantUTF8Info
instance, an
IllegalArgumentException
will be thrown.
If string_index is less than 0
, or greater than or equal to classFile.getCPInfoCount()
, an IndexOutOfBoundsException
will be thrown.
classFile
- the ClassFile
instance that contains a ConstantStringInfo
instance that is equal to constantStringInfo
constantStringInfo
- the ConstantStringInfo
instance that contains the string_indexConstantUTF8Info
that is located on the index constantStringInfo.getStringIndex()
in the constant_pool table of classFile
java.lang.IllegalArgumentException
- thrown if, and only if, classFile
does not contain a ConstantStringInfo
instance that is equal to constantStringInfo
, or the CPInfo
on the index string_index is not a
ConstantUTF8Info
instancejava.lang.IndexOutOfBoundsException
- thrown if, and only if, string_index is less than 0
, or greater than or equal to classFile.getCPInfoCount()
java.lang.NullPointerException
- thrown if, and only if, either classFile
or constantStringInfo
are null
public static ConstantUTF8Info newInstance(java.lang.String string)
ConstantUTF8Info
.
If string
is null
, a NullPointerException
will be thrown.
string
- the String
representation of the new ConstantUTF8Info
instanceConstantUTF8Info
java.lang.NullPointerException
- thrown if, and only if, string
is null
public static java.util.List<ConstantUTF8Info> filter(Node node)
List
with all ConstantUTF8Info
s.
All ConstantUTF8Info
s are found by traversing node
using a simple NodeHierarchicalVisitor
implementation.
If node
is null
, a NullPointerException
will be thrown.
node
- the Node
to start traversal fromList
with all ConstantUTF8Info
sjava.lang.NullPointerException
- thrown if, and only if, node
is null
public static NodeFilter newAnyNodeFilter()
NodeFilter
that accepts Node
s that are instances of ConstantUTF8Info
.
The NodeFilter
returned by this method will throw a NullPointerException
if, and only if, the Node
to accept or reject is null
. It is also stateless and therefore considered thread-safe.
NodeFilter
that accepts Node
s that are instances of ConstantUTF8Info
public static NodeFilter newRegexNodeFilter(java.lang.String regex)
NodeFilter
that accepts Node
s that are instances of ConstantUTF8Info
and have a getString()
method that matches regex
.
If regex
is null
, a NullPointerException
will be thrown.
The NodeFilter
returned by this method will throw a NullPointerException
if, and only if, the Node
to accept or reject is null
. It is also stateless and therefore considered thread-safe.
regex
- a String
representing a Regex patternNodeFilter
that accepts Node
s that are instances of ConstantUTF8Info
and have a getString()
method that matches regex
java.lang.NullPointerException
- thrown if, and only if, regex
is null