Package javassist.bytecode
Class ParameterAnnotationsAttribute
- java.lang.Object
-
- javassist.bytecode.AttributeInfo
-
- javassist.bytecode.ParameterAnnotationsAttribute
-
public class ParameterAnnotationsAttribute extends AttributeInfo
A class representingRuntimeVisibleAnnotations_attributeandRuntimeInvisibleAnnotations_attribute.To obtain an ParameterAnnotationAttribute object, invoke
getAttribute(ParameterAnnotationsAttribute.invisibleTag)inMethodInfo. The obtained attribute is a runtime invisible annotations attribute. If the parameter isParameterAnnotationAttribute.visibleTag, then the obtained attribute is a runtime visible one.
-
-
Field Summary
Fields Modifier and Type Field Description static StringinvisibleTagThe name of theRuntimeInvisibleParameterAnnotationsattribute.static StringvisibleTagThe name of theRuntimeVisibleParameterAnnotationsattribute.
-
Constructor Summary
Constructors Constructor Description ParameterAnnotationsAttribute(ConstPool cp, String attrname)Constructs an emptyRuntime(In)VisibleParameterAnnotations_attribute.ParameterAnnotationsAttribute(ConstPool cp, String attrname, byte[] info)Constructs aRuntime(In)VisibleParameterAnnotations_attribute.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AttributeInfocopy(ConstPool newCp, Map<String,String> classnames)Copies this attribute and returns a new copy.Annotation[][]getAnnotations()Parses the annotations and returns a data structure representing that parsed annotations.intnumParameters()Returnsnum_parameters.voidsetAnnotations(Annotation[][] params)Changes the annotations represented by this object according to the given array ofAnnotationobjects.StringtoString()Returns a string representation of this object.-
Methods inherited from class javassist.bytecode.AttributeInfo
get, getConstPool, getName, length, set
-
-
-
-
Field Detail
-
visibleTag
public static final String visibleTag
The name of theRuntimeVisibleParameterAnnotationsattribute.- See Also:
- Constant Field Values
-
invisibleTag
public static final String invisibleTag
The name of theRuntimeInvisibleParameterAnnotationsattribute.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ParameterAnnotationsAttribute
public ParameterAnnotationsAttribute(ConstPool cp, String attrname, byte[] info)
Constructs aRuntime(In)VisibleParameterAnnotations_attribute.- Parameters:
cp- constant poolattrname- attribute name (visibleTagorinvisibleTag).info- the contents of this attribute. It does not includeattribute_name_indexorattribute_length.
-
ParameterAnnotationsAttribute
public ParameterAnnotationsAttribute(ConstPool cp, String attrname)
Constructs an emptyRuntime(In)VisibleParameterAnnotations_attribute. A new annotation can be later added to the created attribute bysetAnnotations().- Parameters:
cp- constant poolattrname- attribute name (visibleTagorinvisibleTag).- See Also:
setAnnotations(Annotation[][])
-
-
Method Detail
-
numParameters
public int numParameters()
Returnsnum_parameters.
-
copy
public AttributeInfo copy(ConstPool newCp, Map<String,String> classnames)
Copies this attribute and returns a new copy.- Overrides:
copyin classAttributeInfo- Parameters:
newCp- the constant pool table used by the new copy.classnames- pairs of replaced and substituted class names.
-
getAnnotations
public Annotation[][] getAnnotations()
Parses the annotations and returns a data structure representing that parsed annotations. Note that changes of the node values of the returned tree are not reflected on the annotations represented by this object unless the tree is copied back to this object bysetAnnotations().- Returns:
- Each element of the returned array represents an array of annotations that are associated with each method parameter.
- See Also:
setAnnotations(Annotation[][])
-
setAnnotations
public void setAnnotations(Annotation[][] params)
Changes the annotations represented by this object according to the given array ofAnnotationobjects.- Parameters:
params- the data structure representing the new annotations. Every element of this array is an array ofAnnotationand it represens annotations of each method parameter.
-
-