1. /*
  2. * @(#)SimpleDeclarationVisitor.java 1.3 04/04/30
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.mirror.util;
  8. import com.sun.mirror.declaration.*;
  9. /**
  10. * A simple visitor for declarations.
  11. *
  12. * <p> The implementations of the methods of this class do nothing but
  13. * delegate up the declaration hierarchy. A subclass should override the
  14. * methods that correspond to the kinds of declarations on which it
  15. * will operate.
  16. *
  17. * @author Joseph D. Darcy
  18. * @author Scott Seligman
  19. * @version 1.3 04/04/30
  20. * @since 1.5
  21. */
  22. public class SimpleDeclarationVisitor implements DeclarationVisitor {
  23. /**
  24. * Creates a new <tt>SimpleDeclarationVisitor</tt>.
  25. */
  26. public SimpleDeclarationVisitor(){}
  27. /**
  28. * Visits a declaration.
  29. * The implementation does nothing.
  30. * @param d the declaration to visit
  31. */
  32. public void visitDeclaration(Declaration d) {
  33. }
  34. /**
  35. * Visits a package declaration.
  36. * The implementation simply invokes
  37. * {@link #visitDeclaration visitDeclaration}.
  38. * @param d the declaration to visit
  39. */
  40. public void visitPackageDeclaration(PackageDeclaration d) {
  41. visitDeclaration(d);
  42. }
  43. /**
  44. * Visits a member or constructor declaration.
  45. * The implementation simply invokes
  46. * {@link #visitDeclaration visitDeclaration}.
  47. * @param d the declaration to visit
  48. */
  49. public void visitMemberDeclaration(MemberDeclaration d) {
  50. visitDeclaration(d);
  51. }
  52. /**
  53. * Visits a type declaration.
  54. * The implementation simply invokes
  55. * {@link #visitMemberDeclaration visitMemberDeclaration}.
  56. * @param d the declaration to visit
  57. */
  58. public void visitTypeDeclaration(TypeDeclaration d) {
  59. visitMemberDeclaration(d);
  60. }
  61. /**
  62. * Visits a class declaration.
  63. * The implementation simply invokes
  64. * {@link #visitTypeDeclaration visitTypeDeclaration}.
  65. * @param d the declaration to visit
  66. */
  67. public void visitClassDeclaration(ClassDeclaration d) {
  68. visitTypeDeclaration(d);
  69. }
  70. /**
  71. * Visits an enum declaration.
  72. * The implementation simply invokes
  73. * {@link #visitClassDeclaration visitClassDeclaration}.
  74. * @param d the declaration to visit
  75. */
  76. public void visitEnumDeclaration(EnumDeclaration d) {
  77. visitClassDeclaration(d);
  78. }
  79. /**
  80. * Visits an interface declaration.
  81. * The implementation simply invokes
  82. * {@link #visitTypeDeclaration visitTypeDeclaration}.
  83. * @param d the declaration to visit
  84. */
  85. public void visitInterfaceDeclaration(InterfaceDeclaration d) {
  86. visitTypeDeclaration(d);
  87. }
  88. /**
  89. * Visits an annotation type declaration.
  90. * The implementation simply invokes
  91. * {@link #visitInterfaceDeclaration visitInterfaceDeclaration}.
  92. * @param d the declaration to visit
  93. */
  94. public void visitAnnotationTypeDeclaration(AnnotationTypeDeclaration d) {
  95. visitInterfaceDeclaration(d);
  96. }
  97. /**
  98. * Visits a field declaration.
  99. * The implementation simply invokes
  100. * {@link #visitMemberDeclaration visitMemberDeclaration}.
  101. * @param d the declaration to visit
  102. */
  103. public void visitFieldDeclaration(FieldDeclaration d) {
  104. visitMemberDeclaration(d);
  105. }
  106. /**
  107. * Visits an enum constant declaration.
  108. * The implementation simply invokes
  109. * {@link #visitFieldDeclaration visitFieldDeclaration}.
  110. * @param d the declaration to visit
  111. */
  112. public void visitEnumConstantDeclaration(EnumConstantDeclaration d) {
  113. visitFieldDeclaration(d);
  114. }
  115. /**
  116. * Visits a method or constructor declaration.
  117. * The implementation simply invokes
  118. * {@link #visitMemberDeclaration visitMemberDeclaration}.
  119. * @param d the declaration to visit
  120. */
  121. public void visitExecutableDeclaration(ExecutableDeclaration d) {
  122. visitMemberDeclaration(d);
  123. }
  124. /**
  125. * Visits a constructor declaration.
  126. * The implementation simply invokes
  127. * {@link #visitExecutableDeclaration visitExecutableDeclaration}.
  128. * @param d the declaration to visit
  129. */
  130. public void visitConstructorDeclaration(ConstructorDeclaration d) {
  131. visitExecutableDeclaration(d);
  132. }
  133. /**
  134. * Visits a method declaration.
  135. * The implementation simply invokes
  136. * {@link #visitExecutableDeclaration visitExecutableDeclaration}.
  137. * @param d the declaration to visit
  138. */
  139. public void visitMethodDeclaration(MethodDeclaration d) {
  140. visitExecutableDeclaration(d);
  141. }
  142. /**
  143. * Visits an annotation type element declaration.
  144. * The implementation simply invokes
  145. * {@link #visitMethodDeclaration visitMethodDeclaration}.
  146. * @param d the declaration to visit
  147. */
  148. public void visitAnnotationTypeElementDeclaration(
  149. AnnotationTypeElementDeclaration d) {
  150. visitMethodDeclaration(d);
  151. }
  152. /**
  153. * Visits a parameter declaration.
  154. * The implementation simply invokes
  155. * {@link #visitDeclaration visitDeclaration}.
  156. * @param d the declaration to visit
  157. */
  158. public void visitParameterDeclaration(ParameterDeclaration d) {
  159. visitDeclaration(d);
  160. }
  161. /**
  162. * Visits a type parameter declaration.
  163. * The implementation simply invokes
  164. * {@link #visitDeclaration visitDeclaration}.
  165. * @param d the declaration to visit
  166. */
  167. public void visitTypeParameterDeclaration(TypeParameterDeclaration d) {
  168. visitDeclaration(d);
  169. }
  170. }