public final class ClassFiles
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getAttributeInfoName(ClassFile classFile,
AttributeInfo attributeInfo,
CodeAttribute codeAttribute) |
static java.util.List<ConstantUTF8Info> |
getConstantUTF8InfosReferencedFromConstantClassInfos(ClassFile classFile)
Returns a
List with all ConstantUTF8Info s that are referenced from ConstantClassInfo s in the constant_pool table of classFile . |
static java.util.List<ConstantUTF8Info> |
getConstantUTF8InfosReferencedFromConstantNameAndTypeInfos(ClassFile classFile)
Returns a
List with all ConstantUTF8Info s that are referenced from ConstantNameAndTypeInfo s in the constant_pool table of classFile . |
static java.util.Optional<FieldInfo> |
getFieldInfoByName(ClassFile classFile,
java.lang.String name)
|
static java.lang.String |
getInterfaceName(ClassFile classFile,
int index) |
static java.util.Optional<MethodInfo> |
getMethodInfoByName(ClassFile classFile,
java.lang.String name) |
static boolean |
isClassName(ClassFile classFile,
ConstantUTF8Info constantUTF8Info)
Returns
true if, and only if, constantUTF8Info refers to the name of classFile , false otherwise. |
static boolean |
isConstantClassInfoPointingToNameIndex(ClassFile classFile,
int index)
Returns
true if, and only if, at least one ConstantClassInfo in the constant_pool table of classFile has a name_index that points to index , false otherwise. |
static boolean |
isConstantNameAndTypeInfoPointingToDescriptorIndex(ClassFile classFile,
int index)
Returns
true if, and only if, at least one ConstantNameAndTypeInfo in the constant_pool table of classFile has a descriptor_index that points to index , false otherwise. |
static boolean |
isFieldDescriptor(ClassFile classFile,
ConstantUTF8Info constantUTF8Info)
Returns
true if, and only if, constantUTF8Info refers to the descriptor of a FieldInfo in classFile , false otherwise. |
static boolean |
isFieldInfoName(ClassFile classFile,
ConstantUTF8Info constantUTF8Info)
Returns
true if, and only if, constantUTF8Info refers to the name of a FieldInfo in classFile , false otherwise. |
static boolean |
isMethodDescriptor(ClassFile classFile,
ConstantUTF8Info constantUTF8Info)
Returns
true if, and only if, constantUTF8Info refers to the descriptor of a MethodInfo in classFile , false otherwise. |
static boolean |
isMethodInfoName(ClassFile classFile,
ConstantUTF8Info constantUTF8Info)
Returns
true if, and only if, constantUTF8Info refers to the name of a MethodInfo in classFile , false otherwise. |
public static java.util.List<ConstantUTF8Info> getConstantUTF8InfosReferencedFromConstantClassInfos(ClassFile classFile)
List
with all ConstantUTF8Info
s that are referenced from ConstantClassInfo
s in the constant_pool table of classFile
.
If classFile
is null
, a NullPointerException
will be thrown.
classFile
- a ClassFile
List
with all ConstantUTF8Info
s that are referenced from ConstantClassInfo
s in the constant_pool table of classFile
java.lang.NullPointerException
- thrown if, and only if, classFile
is null
public static java.util.List<ConstantUTF8Info> getConstantUTF8InfosReferencedFromConstantNameAndTypeInfos(ClassFile classFile)
List
with all ConstantUTF8Info
s that are referenced from ConstantNameAndTypeInfo
s in the constant_pool table of classFile
.
If classFile
is null
, a NullPointerException
will be thrown.
classFile
- a ClassFile
List
with all ConstantUTF8Info
s that are referenced from ConstantNameAndTypeInfo
s in the constant_pool table of classFile
java.lang.NullPointerException
- thrown if, and only if, classFile
is null
public static java.util.Optional<FieldInfo> getFieldInfoByName(ClassFile classFile, java.lang.String name)
FieldInfo
provided by classFile
given name
.
If either classFile
or name
are null
, a NullPointerException
will be thrown.
classFile
- a ClassFile
name
- the name of the FieldInfo
to getFieldInfo
provided by classFile
given name
java.lang.NullPointerException
- thrown if, and only if, either classFile
or name
are null
public static java.util.Optional<MethodInfo> getMethodInfoByName(ClassFile classFile, java.lang.String name)
public static java.lang.String getAttributeInfoName(ClassFile classFile, AttributeInfo attributeInfo, CodeAttribute codeAttribute)
public static java.lang.String getInterfaceName(ClassFile classFile, int index)
public static boolean isClassName(ClassFile classFile, ConstantUTF8Info constantUTF8Info)
true
if, and only if, constantUTF8Info
refers to the name of classFile
, false
otherwise.
If either classFile
or constantUTF8Info
are null
, a NullPointerException
will be thrown.
classFile
- a ClassFile
constantUTF8Info
- a ConstantUTF8Info
true
if, and only if, constantUTF8Info
refers to the name of a classFile
, false
otherwisejava.lang.NullPointerException
- thrown if, and only if, either classFile
or constantUTF8Info
are null
public static boolean isConstantClassInfoPointingToNameIndex(ClassFile classFile, int index)
true
if, and only if, at least one ConstantClassInfo
in the constant_pool table of classFile
has a name_index that points to index
, false
otherwise.
If index
does not point to a valid index in the constant_pool table of classFile
, an IllegalArgumentException
will be thrown.
If classFile
is null
, a NullPointerException
will be thrown.
classFile
- a ClassFile
index
- an index into the constant_pool table of classFile
true
if, and only if, at least one ConstantClassInfo
in the constant_pool table of classFile
has a name_index that points to index
, false
otherwisejava.lang.IllegalArgumentException
- thrown if, and only if, index
does not point to a valid index in the constant_pool table of classFile
java.lang.NullPointerException
- thrown if, and only if, classFile
is null
public static boolean isConstantNameAndTypeInfoPointingToDescriptorIndex(ClassFile classFile, int index)
true
if, and only if, at least one ConstantNameAndTypeInfo
in the constant_pool table of classFile
has a descriptor_index that points to index
, false
otherwise.
If index
does not point to a valid index in the constant_pool table of classFile
, an IllegalArgumentException
will be thrown.
If classFile
is null
, a NullPointerException
will be thrown.
classFile
- a ClassFile
index
- an index into the constant_pool table of classFile
true
if, and only if, at least one ConstantNameAndTypeInfo
in the constant_pool table of classFile
has a descriptor_index that points to index
, false
otherwisejava.lang.IllegalArgumentException
- thrown if, and only if, index
does not point to a valid index in the constant_pool table of classFile
java.lang.NullPointerException
- thrown if, and only if, classFile
is null
public static boolean isFieldDescriptor(ClassFile classFile, ConstantUTF8Info constantUTF8Info)
true
if, and only if, constantUTF8Info
refers to the descriptor of a FieldInfo
in classFile
, false
otherwise.
If either classFile
or constantUTF8Info
are null
, a NullPointerException
will be thrown.
classFile
- the ClassFile
that contains constantUTF8Info
constantUTF8Info
- the ConstantUTF8Info
that should refer to the descriptor of a FieldInfo
in classFile
true
if, and only if, constantUTF8Info
refers to the descriptor of a FieldInfo
in classFile
, false
otherwisejava.lang.NullPointerException
- thrown if, and only if, either classFile
or constantUTF8Info
are null
public static boolean isFieldInfoName(ClassFile classFile, ConstantUTF8Info constantUTF8Info)
true
if, and only if, constantUTF8Info
refers to the name of a FieldInfo
in classFile
, false
otherwise.
If either classFile
or constantUTF8Info
are null
, a NullPointerException
will be thrown.
classFile
- the ClassFile
that contains constantUTF8Info
constantUTF8Info
- the ConstantUTF8Info
that should refer to the name of a FieldInfo
in classFile
true
if, and only if, constantUTF8Info
refers to the name of a FieldInfo
in classFile
, false
otherwisejava.lang.NullPointerException
- thrown if, and only if, either classFile
or constantUTF8Info
are null
public static boolean isMethodDescriptor(ClassFile classFile, ConstantUTF8Info constantUTF8Info)
true
if, and only if, constantUTF8Info
refers to the descriptor of a MethodInfo
in classFile
, false
otherwise.
If either classFile
or constantUTF8Info
are null
, a NullPointerException
will be thrown.
classFile
- the ClassFile
that contains constantUTF8Info
constantUTF8Info
- the ConstantUTF8Info
that should refer to the descriptor of a MethodInfo
in classFile
true
if, and only if, constantUTF8Info
refers to the descriptor of a MethodInfo
in classFile
, false
otherwisejava.lang.NullPointerException
- thrown if, and only if, either classFile
or constantUTF8Info
are null
public static boolean isMethodInfoName(ClassFile classFile, ConstantUTF8Info constantUTF8Info)
true
if, and only if, constantUTF8Info
refers to the name of a MethodInfo
in classFile
, false
otherwise.
If either classFile
or constantUTF8Info
are null
, a NullPointerException
will be thrown.
classFile
- the ClassFile
that contains constantUTF8Info
constantUTF8Info
- the ConstantUTF8Info
that should refer to the name of a MethodInfo
in classFile
true
if, and only if, constantUTF8Info
refers to the name of a MethodInfo
in classFile
, false
otherwisejava.lang.NullPointerException
- thrown if, and only if, either classFile
or constantUTF8Info
are null