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.

ArrayAnnotationValue.java 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* *******************************************************************
  2. * Copyright (c) 2006 Contributors
  3. * All rights reserved.
  4. * This program and the accompanying materials are made available
  5. * under the terms of the Eclipse Public License v1.0
  6. * which accompanies this distribution and is available at
  7. * http://www.eclipse.org/legal/epl-v10.html
  8. *
  9. * Contributors:
  10. * Andy Clement IBM initial implementation
  11. * ******************************************************************/
  12. package org.aspectj.weaver;
  13. public class ArrayAnnotationValue extends AnnotationValue {
  14. private AnnotationValue[] values;
  15. public ArrayAnnotationValue() {
  16. super(AnnotationValue.ARRAY);
  17. }
  18. public void setValues(AnnotationValue[] values) {
  19. this.values = values;
  20. }
  21. public ArrayAnnotationValue(AnnotationValue[] values) {
  22. super(AnnotationValue.ARRAY);
  23. this.values = values;
  24. }
  25. public AnnotationValue[] getValues() {
  26. return values;
  27. }
  28. public String stringify() {
  29. StringBuffer sb = new StringBuffer();
  30. sb.append("[");
  31. for (int i = 0; i < values.length; i++) {
  32. sb.append(values[i].stringify());
  33. if (i + 1 < values.length)
  34. sb.append(",");
  35. }
  36. sb.append("]");
  37. return sb.toString();
  38. }
  39. public String toString() {
  40. StringBuffer sb = new StringBuffer();
  41. sb.append("{");
  42. for (int i = 0; i < values.length; i++) {
  43. sb.append(values[i].toString());
  44. if ((i + 1) < values.length)
  45. sb.append(",");
  46. }
  47. sb.append("}");
  48. return sb.toString();
  49. }
  50. }