public class ClassItem
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.lang.String[] |
m_argTypes
Argument types for method.
|
private ClassFile |
m_classFile
Owning class information.
|
private FieldOrMethod |
m_item
Wrapped existing item.
|
private java.lang.String |
m_name
Item name.
|
private java.lang.String[] |
m_parmNames
Parameter names for method (
null if not yet found). |
private java.lang.String |
m_signature
Encoded signature.
|
private java.lang.String |
m_typeName
Fully qualified class name of item type.
|
private static java.util.HashMap |
s_primitiveMap
Map for primitive type signature variants.
|
private static java.util.HashMap |
s_signatureParamsMap
Map from method signature to array of argument types.
|
private static java.util.HashMap |
s_signatureTypeMap
Map from method signature to return type.
|
private static java.util.HashMap |
s_typeMap
Map from type name to BCEL type.
|
private static byte |
SIGNATURE_ATTRIBUTE_TAG
Tag value for signature attribute.
|
Constructor and Description |
---|
ClassItem(java.lang.String name,
ClassFile cf,
FieldOrMethod item)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static ClassItem |
findStaticMethod(java.lang.String name,
java.lang.String[] sigs)
Get static method by fully qualified name.
|
static ClassItem |
findVirtualMethod(java.lang.String name,
java.lang.String[] sigs)
Get virtual method by fully qualified name.
|
int |
getAccessFlags()
Get access flags.
|
int |
getArgumentCount()
Get number of arguments for method.
|
java.lang.String |
getArgumentType(int index)
Get argument type as fully qualified class name.
|
java.lang.String[] |
getArgumentTypes()
Get argument types as array of fully qualified class names.
|
ClassFile |
getClassFile()
Get owning class information.
|
java.lang.String[] |
getExceptions()
Get names of exceptions thrown by method.
|
java.lang.String |
getFullName()
Get fully-qualified class and method name.
|
java.lang.String |
getGenericsSignature()
Get the generics signature information for item.
|
java.lang.String |
getName()
Get item name.
|
java.lang.String |
getParameterName(int index)
Get method parameter name.
|
static java.lang.String[] |
getParametersFromSignature(java.lang.String sig)
Get parameter type names from method signature.
|
static java.lang.String |
getPrimitiveSignature(java.lang.String type)
Get the signature for a primitive.
|
java.lang.String |
getSignature()
Get method signature.
|
static java.lang.String[] |
getSignatureVariants(java.lang.String name)
Get all variant signatures for a fully qualified class name.
|
static java.lang.String |
getTypeFromSignature(java.lang.String sig)
Get return type names from method signature.
|
java.lang.String |
getTypeName()
Get item type as fully qualified class name.
|
static boolean |
isAssignable(java.lang.String from,
java.lang.String to)
Check if a value of one type can be directly assigned to another type.
|
boolean |
isInitializer()
Check if item is an initializer.
|
boolean |
isMethod()
Check if item is a method.
|
static boolean |
isPrimitive(java.lang.String type)
Check if type is a primitive.
|
boolean |
isStatic()
Check if item is a static.
|
void |
makeAccessible(ClassFile src)
Make accessible item.
|
void |
setAccessFlags(int flags)
Set access flags.
|
static Type |
typeFromName(java.lang.String name)
Create type from name.
|
private static final byte SIGNATURE_ATTRIBUTE_TAG
private static java.util.HashMap s_primitiveMap
private static java.util.HashMap s_typeMap
private static java.util.HashMap s_signatureParamsMap
private static java.util.HashMap s_signatureTypeMap
private ClassFile m_classFile
private java.lang.String m_name
private java.lang.String m_signature
private java.lang.String m_typeName
private java.lang.String[] m_argTypes
private java.lang.String[] m_parmNames
null
if not yet found).private FieldOrMethod m_item
public ClassItem(java.lang.String name, ClassFile cf, FieldOrMethod item)
name
- field or method namecf
- owning class informationitem
- field or method informationpublic ClassFile getClassFile()
public java.lang.String getName()
public java.lang.String getFullName()
public java.lang.String getTypeName()
public int getArgumentCount()
public java.lang.String getArgumentType(int index)
index
- argument numberpublic java.lang.String getParameterName(int index)
index
- parameter indexpublic java.lang.String[] getArgumentTypes()
public int getAccessFlags()
public void setAccessFlags(int flags)
flags
- access flags for field or methodpublic void makeAccessible(ClassFile src)
src
- class file for required accesspublic boolean isStatic()
true
if a static, false
if memberpublic java.lang.String getSignature()
public boolean isMethod()
true
if a method, false
if a fieldpublic boolean isInitializer()
true
if an initializer, false
if a
field or normal methodpublic java.lang.String[] getExceptions()
null
if
a fieldpublic java.lang.String getGenericsSignature()
null
if none)public static boolean isPrimitive(java.lang.String type)
type
- true
if a primitive, false
if notpublic static java.lang.String getPrimitiveSignature(java.lang.String type)
type
- public static java.lang.String[] getParametersFromSignature(java.lang.String sig)
sig
- method signature to be decodedpublic static java.lang.String getTypeFromSignature(java.lang.String sig)
sig
- method signature to be decodedpublic static Type typeFromName(java.lang.String name)
name
- fully qualified type namepublic static ClassItem findVirtualMethod(java.lang.String name, java.lang.String[] sigs) throws JiBXException
name
- fully qualified class and method namesigs
- possible method signaturesnull
if not foundJiBXException
- if configuration errorpublic static ClassItem findStaticMethod(java.lang.String name, java.lang.String[] sigs) throws JiBXException
name
- fully qualified class and method namesigs
- possible method signaturesnull
if not foundJiBXException
- if configuration errorpublic static java.lang.String[] getSignatureVariants(java.lang.String name) throws JiBXException
name
- fully qualified class nameJiBXException
- if configuration errorpublic static boolean isAssignable(java.lang.String from, java.lang.String to) throws JiBXException
from
- fully qualified class name of initial typeto
- fully qualified class name of assignment typetrue
if assignable, false
if notJiBXException
- if configuration error