javassist.bytecode
Class ParameterAnnotationsAttribute

java.lang.Object
  extended by javassist.bytecode.AttributeInfo
      extended by javassist.bytecode.ParameterAnnotationsAttribute

public class ParameterAnnotationsAttribute
extends AttributeInfo

A class representing RuntimeVisibleAnnotations_attribute and RuntimeInvisibleAnnotations_attribute.

To obtain an ParameterAnnotationAttribute object, invoke getAttribute(ParameterAnnotationsAttribute.invisibleTag) in MethodInfo. The obtained attribute is a runtime invisible annotations attribute. If the parameter is ParameterAnnotationAttribute.visibleTag, then the obtained attribute is a runtime visible one.


Field Summary
static java.lang.String invisibleTag
          The name of the RuntimeInvisibleParameterAnnotations attribute.
static java.lang.String visibleTag
          The name of the RuntimeVisibleParameterAnnotations attribute.
 
Constructor Summary
ParameterAnnotationsAttribute(ConstPool cp, java.lang.String attrname)
          Constructs an empty Runtime(In)VisibleParameterAnnotations_attribute.
ParameterAnnotationsAttribute(ConstPool cp, java.lang.String attrname, byte[] info)
          Constructs a Runtime(In)VisibleParameterAnnotations_attribute.
 
Method Summary
 AttributeInfo copy(ConstPool newCp, java.util.Map classnames)
          Copies this attribute and returns a new copy.
 Annotation[][] getAnnotations()
          Parses the annotations and returns a data structure representing that parsed annotations.
 int numParameters()
          Returns num_parameters.
 void setAnnotations(Annotation[][] params)
          Changes the annotations represented by this object according to the given array of Annotation objects.
 
Methods inherited from class javassist.bytecode.AttributeInfo
get, getConstPool, getName, length, set
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

visibleTag

public static final java.lang.String visibleTag
The name of the RuntimeVisibleParameterAnnotations attribute.

See Also:
Constant Field Values

invisibleTag

public static final java.lang.String invisibleTag
The name of the RuntimeInvisibleParameterAnnotations attribute.

See Also:
Constant Field Values
Constructor Detail

ParameterAnnotationsAttribute

public ParameterAnnotationsAttribute(ConstPool cp,
                                     java.lang.String attrname,
                                     byte[] info)
Constructs a Runtime(In)VisibleParameterAnnotations_attribute.

Parameters:
cp - constant pool
attrname - attribute name (visibleTag or invisibleTag).
info - the contents of this attribute. It does not include attribute_name_index or attribute_length.

ParameterAnnotationsAttribute

public ParameterAnnotationsAttribute(ConstPool cp,
                                     java.lang.String attrname)
Constructs an empty Runtime(In)VisibleParameterAnnotations_attribute. A new annotation can be later added to the created attribute by setAnnotations().

Parameters:
cp - constant pool
attrname - attribute name (visibleTag or invisibleTag).
See Also:
setAnnotations(Annotation[][])
Method Detail

numParameters

public int numParameters()
Returns num_parameters.


copy

public AttributeInfo copy(ConstPool newCp,
                          java.util.Map classnames)
Copies this attribute and returns a new copy.

Overrides:
copy in class AttributeInfo
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 by setAnnotations().

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 of Annotation objects.

Parameters:
params - the data structure representing the new annotations. Every element of this array is an array of Annotation and it represens annotations of each method parameter.


Javassist, a Java-bytecode translator toolkit.
Copyright (C) 1999-2010 Shigeru Chiba. All Rights Reserved.