Package javassist.bytecode
Class SignatureAttribute
- java.lang.Object
-
- javassist.bytecode.AttributeInfo
-
- javassist.bytecode.SignatureAttribute
-
public class SignatureAttribute extends AttributeInfo
Signature_attribute.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSignatureAttribute.ArrayTypeArray types.static classSignatureAttribute.BaseTypePrimitive types.static classSignatureAttribute.ClassSignatureClass signature.static classSignatureAttribute.ClassTypeClass types.static classSignatureAttribute.MethodSignatureMethod type signature.static classSignatureAttribute.NestedClassTypeNested class types.static classSignatureAttribute.ObjectTypeClass types, array types, and type variables.static classSignatureAttribute.TypePrimitive types and object types.static classSignatureAttribute.TypeArgumentType argument.static classSignatureAttribute.TypeParameterFormal type parameters.static classSignatureAttribute.TypeVariableType variables.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringtagThe name of this attribute"Signature".
-
Constructor Summary
Constructors Constructor Description SignatureAttribute(ConstPool cp, java.lang.String signature)Constructs aSignatureattribute.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AttributeInfocopy(ConstPool newCp, java.util.Map<java.lang.String,java.lang.String> classnames)Makes a copy.java.lang.StringgetSignature()Returns the generic signature indicated bysignature_index.voidsetSignature(java.lang.String sig)Setssignature_indexto the index of the given generic signature, which is added to a constant pool.static SignatureAttribute.ClassSignaturetoClassSignature(java.lang.String sig)Parses the given signature string as a class signature.static SignatureAttribute.ObjectTypetoFieldSignature(java.lang.String sig)Parses the given signature string as a field type signature.static SignatureAttribute.MethodSignaturetoMethodSignature(java.lang.String sig)Parses the given signature string as a method type signature.static SignatureAttribute.TypetoTypeSignature(java.lang.String sig)Parses the given signature string as a type signature.-
Methods inherited from class javassist.bytecode.AttributeInfo
get, getConstPool, getName, length, set
-
-
-
-
Field Detail
-
tag
public static final java.lang.String tag
The name of this attribute"Signature".- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SignatureAttribute
public SignatureAttribute(ConstPool cp, java.lang.String signature)
Constructs aSignatureattribute.- Parameters:
cp- a constant pool table.signature- the signature represented by this attribute.
-
-
Method Detail
-
getSignature
public java.lang.String getSignature()
Returns the generic signature indicated bysignature_index.
-
setSignature
public void setSignature(java.lang.String sig)
Setssignature_indexto the index of the given generic signature, which is added to a constant pool.- Parameters:
sig- new signature.- Since:
- 3.11
-
copy
public AttributeInfo copy(ConstPool newCp, java.util.Map<java.lang.String,java.lang.String> classnames)
Makes a copy. Class names are replaced according to the givenMapobject.- Overrides:
copyin classAttributeInfo- Parameters:
newCp- the constant pool table used by the new copy.classnames- pairs of replaced and substituted class names.
-
toClassSignature
public static SignatureAttribute.ClassSignature toClassSignature(java.lang.String sig) throws BadBytecode
Parses the given signature string as a class signature.- Parameters:
sig- the signature obtained from theSignatureAttributeof aClassFile.- Returns:
- a tree-like data structure representing a class signature. It provides convenient accessor methods.
- Throws:
BadBytecode- thrown when a syntactical error is found.- Since:
- 3.5
- See Also:
getSignature()
-
toMethodSignature
public static SignatureAttribute.MethodSignature toMethodSignature(java.lang.String sig) throws BadBytecode
Parses the given signature string as a method type signature.- Parameters:
sig- the signature obtained from theSignatureAttributeof aMethodInfo.- Returns:
- Throws:
BadBytecode- thrown when a syntactical error is found.- Since:
- 3.5
- See Also:
getSignature()
-
toFieldSignature
public static SignatureAttribute.ObjectType toFieldSignature(java.lang.String sig) throws BadBytecode
Parses the given signature string as a field type signature.- Parameters:
sig- the signature string obtained from theSignatureAttributeof aFieldInfo.- Returns:
- the field type signature.
- Throws:
BadBytecode- thrown when a syntactical error is found.- Since:
- 3.5
- See Also:
getSignature()
-
toTypeSignature
public static SignatureAttribute.Type toTypeSignature(java.lang.String sig) throws BadBytecode
Parses the given signature string as a type signature. The type signature is either the field type signature or a base type descriptor includingvoidtype.- Throws:
BadBytecode- thrown when a syntactical error is found.- Since:
- 3.18
-
-