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.

AnnotationsVisitor.java 5.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. /*
  2. * Javassist, a Java-bytecode translator toolkit.
  3. * Copyright (C) 1999-2004 Shigeru Chiba. All Rights Reserved.
  4. *
  5. * The contents of this file are subject to the Mozilla Public License Version
  6. * 1.1 (the "License"); you may not use this file except in compliance with
  7. * the License. Alternatively, the contents of this file may be used under
  8. * the terms of the GNU Lesser General Public License Version 2.1 or later.
  9. *
  10. * Software distributed under the License is distributed on an "AS IS" basis,
  11. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. * for the specific language governing rights and limitations under the
  13. * License.
  14. */
  15. package javassist.bytecode.annotation;
  16. import javassist.bytecode.ConstPool;
  17. /**
  18. * Visitor for parsing an annotations attribute.
  19. *
  20. * @see AnnotationsAttribute#accept(AnnotationsVisitor)
  21. * @see ParameterAnnotationsAttribute#accept(AnnotationsVisitor)
  22. */
  23. public class AnnotationsVisitor {
  24. /**
  25. * Invoked when the parser starts parsing a
  26. * <code>parameter_annotations</code> array.
  27. * If the annotations attribute is not a parameter annotations attribute,
  28. * this method is never invoked.
  29. *
  30. * @param numParameters <code>num_parameters</code>.
  31. */
  32. public void beginParameters(int numParameters) throws Exception {}
  33. /**
  34. * Invoked when the parser ends parsing a
  35. * <code>parameter_annotations</code> array.
  36. * If the annotations attribute is not a parameter annotations attribute,
  37. * this method is never invoked.
  38. */
  39. public void endParameters() throws Exception {}
  40. /**
  41. * Invoked when the parser starts parsing an
  42. * <code>annotations</code> array in
  43. * <code>..Annotations_attribute</code>.
  44. *
  45. * @param numAnnotations <code>num_annotations</code>.
  46. */
  47. public void beginAnnotationsArray(int numAnnotations)
  48. throws Exception {}
  49. /**
  50. * Invoked when the parser ends parsing an
  51. * <code>annotations</code> array in
  52. * <code>..Annotations_attribute</code>.
  53. */
  54. public void endAnnotationsArray() throws Exception {}
  55. /**
  56. * Invoked when the parser starts parsing an element of
  57. * <code>annotations</code> array in
  58. * <code>Runtime(In)VisibleAnnotations_attribute</code>
  59. * or <code>parameter_annotations</code> array.
  60. *
  61. * @param cp the constant pool.
  62. * @param typeIndex <code>type_index</code>.
  63. * @param numMemberValuePairs <code>num_member_value_pairs</code>.
  64. */
  65. public void beginAnnotation(ConstPool cp,
  66. int typeIndex, int numMemberValuePairs) throws Exception {}
  67. /**
  68. * Invoked when the parser ends parsing an element of
  69. * <code>annotations</code> array in
  70. * <code>Runtime(In)VisibleAnnotations_attribute</code>
  71. * or <code>parameter_annotations</code> array.
  72. */
  73. public void endAnnotation() throws Exception {}
  74. /**
  75. * Invoked when the parser starts parsing an element of
  76. * <code>member_value_pairs</code> array in <code>annotation</code>.
  77. *
  78. * @param cp the constant pool.
  79. * @param memberNameIndex <code>member_name_index</code>.
  80. */
  81. public void beginMemberValuePair(ConstPool cp, int memberNameIndex)
  82. throws Exception {}
  83. /**
  84. * Invoked when the parser ends parsing an element of
  85. * <code>member_value_pairs</code> array in <code>annotation</code>.
  86. */
  87. public void endMemberValuePair() throws Exception {}
  88. /**
  89. * Invoked when the parser parses <code>const_value_index</code>
  90. * in <code>member_value</code>.
  91. *
  92. * @param cp the constant pool.
  93. * @param tag <code>tag</code>.
  94. * @param index <code>const_value_index</code>.
  95. */
  96. public void constValueIndex(ConstPool cp, int tag, int index)
  97. throws Exception {}
  98. /**
  99. * Invoked when the parser parses <code>enum_const_value</code>
  100. * in <code>member_value</code>.
  101. *
  102. * @param cp the constant pool.
  103. * @param typeNameIndex <code>type_name_index</code>.
  104. * @param constNameIndex <code>const_name_index</code>.
  105. */
  106. public void enumConstValue(ConstPool cp, int typeNameIndex,
  107. int constNameIndex) throws Exception {}
  108. /**
  109. * Invoked when the parser parses <code>class_info_index</code>
  110. * in <code>member_value</code>.
  111. *
  112. * @param cp the constant pool.
  113. * @param index <code>class_info_index</code>.
  114. */
  115. public void classInfoIndex(ConstPool cp, int index) throws Exception {}
  116. /**
  117. * Invoked when the parser starts parsing <code>annotation_value</code>
  118. * in <code>member_value</code>.
  119. */
  120. public void beginAnnotationValue() throws Exception {}
  121. /**
  122. * Invoked when the parser endss parsing <code>annotation_value</code>
  123. * in <code>member_value</code>.
  124. */
  125. public void endAnnotationValue() throws Exception {}
  126. /**
  127. * Invoked when the parser starts parsing <code>array_value</code>
  128. * in <code>member_value</code>.
  129. *
  130. * @param numValues <code>num_values</code>.
  131. */
  132. public void beginArrayValue(int numValues) throws Exception {}
  133. /**
  134. * Invoked when the parser ends parsing an element of
  135. * <code>array_value</code>.
  136. *
  137. * @param i the index of that element.
  138. */
  139. public void arrayElement(int i) throws Exception {}
  140. /**
  141. * Invoked when the parser ends parsing <code>array_value</code>
  142. * in <code>member_value</code>.
  143. */
  144. public void endArrayValue() throws Exception {}
  145. }