FileDocCategorySizeDatePackage
AnnotatedMethodAttribute.javaAPI DocGlassfish v2 API5443Fri May 04 22:34:28 BST 2007com.sun.jdo.api.persistence.enhancer.classfile

AnnotatedMethodAttribute

public class AnnotatedMethodAttribute extends ClassAttribute
AnnotatedMethodAttribute represents a class level attribute class file which identifies the level of annotation of the class.

Fields Summary
public static final String
expectedAttrName
public static final short
expectedAttrVersion
public static final short
generatedFlag
public static final short
annotatedFlag
public static final short
modifiedFlag
private short
attrVersion
private short
annotationFlags
private InsnTarget[]
annotationRanges
Constructors Summary
public AnnotatedMethodAttribute(ConstUtf8 nameAttr, short version, short annFlags, InsnTarget[] annRanges)
Constructor

    super(nameAttr);
    attrVersion = version;
    annotationFlags = annFlags;
    annotationRanges = annRanges;
  
Methods Summary
public InsnTarget[]getAnnotationRanges()

    return annotationRanges;
  
public shortgetFlags()

    return annotationFlags;
  
public shortgetVersion()


  /* public accessors */

     
    return attrVersion;
  
voidprint(java.io.PrintStream out, int indent)

    ClassPrint.spaces(out, indent);
    out.println("version: " + attrVersion);//NOI18N
    out.println(" flags: " + annotationFlags);//NOI18N
    if (annotationRanges != null) {
        out.println("Annotations: ");//NOI18N
      for (int i=0; i<annotationRanges.length/2; i++) {
	ClassPrint.spaces(out, indent+2);
	out.println(annotationRanges[i*2] + " to " +//NOI18N
		    annotationRanges[i*2+1]);
      }
    }
  
static com.sun.jdo.api.persistence.enhancer.classfile.AnnotatedMethodAttributeread(ConstUtf8 attrName, java.io.DataInputStream data, CodeEnv env)

    short version = data.readShort();
    short annFlags = data.readShort();

    short nRanges = data.readShort();

    InsnTarget ranges[] = new InsnTarget[nRanges*2];
    for (int i=0; i<nRanges; i++) {
      ranges[i*2] = env.getTarget(data.readShort());
      ranges[i*2+1] = env.getTarget(data.readShort());
    }
    return  new AnnotatedMethodAttribute(attrName, version, annFlags, ranges);
  
public voidsetAnnotationRanges(InsnTarget[] ranges)

    annotationRanges = ranges;
  
public voidsetFlags(short flags)

    annotationFlags = flags;
  
public voidsetVersion(short version)

    attrVersion = version;
  
voidwrite(java.io.DataOutputStream out)

    out.writeShort(attrName().getIndex());
    if (annotationRanges == null)
      out.writeShort(2);
    else
      out.writeShort(4 + 2 * annotationRanges.length);
    out.writeShort(attrVersion);
    out.writeShort(annotationFlags);
    if (annotationRanges == null)
      out.writeShort(0);
    else {
      out.writeShort(annotationRanges.length / 2);
      for (int i=0; i<annotationRanges.length; i++)
	out.writeShort(annotationRanges[i].offset());
    }