You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AnnotationElementValueGen.java 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* *******************************************************************
  2. * Copyright (c) 2004 IBM
  3. * All rights reserved.
  4. * This program and the accompanying materials are made available
  5. * under the terms of the Common Public License v1.0
  6. * which accompanies this distribution and is available at
  7. * http://www.eclipse.org/legal/cpl-v10.html
  8. *
  9. * Contributors:
  10. * Andy Clement - initial implementation {date}
  11. * ******************************************************************/
  12. package org.aspectj.apache.bcel.generic.annotation;
  13. import java.io.DataOutputStream;
  14. import java.io.IOException;
  15. import org.aspectj.apache.bcel.classfile.annotation.AnnotationElementValue;
  16. import org.aspectj.apache.bcel.generic.ConstantPoolGen;
  17. public class AnnotationElementValueGen extends ElementValueGen {
  18. // For annotation element values, this is the annotation
  19. private AnnotationGen a;
  20. public AnnotationElementValueGen(AnnotationGen a,ConstantPoolGen cpool) {
  21. super(ANNOTATION,cpool);
  22. this.a = a;
  23. }
  24. public AnnotationElementValueGen(int type, AnnotationGen annotation, ConstantPoolGen cpool) {
  25. super(type,cpool);
  26. if (type != ANNOTATION)
  27. throw new RuntimeException("Only element values of type annotation can be built with this ctor");
  28. this.a = annotation;
  29. }
  30. public AnnotationElementValueGen(AnnotationElementValue value, ConstantPoolGen cpool) {
  31. super(ANNOTATION,cpool);
  32. a = new AnnotationGen(value.getAnnotation(),cpool);
  33. }
  34. public void dump(DataOutputStream dos) throws IOException {
  35. dos.writeByte(type); // u1 type of value (ANNOTATION == '@')
  36. a.dump(dos);
  37. }
  38. public String stringifyValue() {
  39. throw new RuntimeException("Not implemented yet");
  40. }
  41. public AnnotationGen getAnnotation() { return a;}
  42. }