1. /*
  2. * @(#)SimpleTypeVisitor.java 1.4 04/06/07
  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.type.*;
  9. /**
  10. * A simple visitor for types.
  11. *
  12. * <p> The implementations of the methods of this class do nothing but
  13. * delegate up the type hierarchy. A subclass should override the
  14. * methods that correspond to the kinds of types on which it will
  15. * operate.
  16. *
  17. * @author Joseph D. Darcy
  18. * @author Scott Seligman
  19. * @version 1.4 04/06/07
  20. * @since 1.5
  21. */
  22. public class SimpleTypeVisitor implements TypeVisitor {
  23. /**
  24. * Creates a new <tt>SimpleTypeVisitor</tt>.
  25. */
  26. public SimpleTypeVisitor() {}
  27. /**
  28. * Visits a type mirror.
  29. * The implementation does nothing.
  30. * @param t the type to visit
  31. */
  32. public void visitTypeMirror(TypeMirror t) {
  33. }
  34. /**
  35. * Visits a primitive type.
  36. * The implementation simply invokes
  37. * {@link #visitTypeMirror visitTypeMirror}.
  38. * @param t the type to visit
  39. */
  40. public void visitPrimitiveType(PrimitiveType t) {
  41. visitTypeMirror(t);
  42. }
  43. /**
  44. * Visits a void type.
  45. * The implementation simply invokes
  46. * {@link #visitTypeMirror visitTypeMirror}.
  47. * @param t the type to visit
  48. */
  49. public void visitVoidType(VoidType t) {
  50. visitTypeMirror(t);
  51. }
  52. /**
  53. * Visits a reference type.
  54. * The implementation simply invokes
  55. * {@link #visitTypeMirror visitTypeMirror}.
  56. * @param t the type to visit
  57. */
  58. public void visitReferenceType(ReferenceType t) {
  59. visitTypeMirror(t);
  60. }
  61. /**
  62. * Visits a declared type.
  63. * The implementation simply invokes
  64. * {@link #visitReferenceType visitReferenceType}.
  65. * @param t the type to visit
  66. */
  67. public void visitDeclaredType(DeclaredType t) {
  68. visitReferenceType(t);
  69. }
  70. /**
  71. * Visits a class type.
  72. * The implementation simply invokes
  73. * {@link #visitDeclaredType visitDeclaredType}.
  74. * @param t the type to visit
  75. */
  76. public void visitClassType(ClassType t) {
  77. visitDeclaredType(t);
  78. }
  79. /**
  80. * Visits an enum type.
  81. * The implementation simply invokes
  82. * {@link #visitClassType visitClassType}.
  83. * @param t the type to visit
  84. */
  85. public void visitEnumType(EnumType t) {
  86. visitClassType(t);
  87. }
  88. /**
  89. * Visits an interface type.
  90. * The implementation simply invokes
  91. * {@link #visitDeclaredType visitDeclaredType}.
  92. * @param t the type to visit
  93. */
  94. public void visitInterfaceType(InterfaceType t) {
  95. visitDeclaredType(t);
  96. }
  97. /**
  98. * Visits an annotation type.
  99. * The implementation simply invokes
  100. * {@link #visitInterfaceType visitInterfaceType}.
  101. * @param t the type to visit
  102. */
  103. public void visitAnnotationType(AnnotationType t) {
  104. visitInterfaceType(t);
  105. }
  106. /**
  107. * Visits an array type.
  108. * The implementation simply invokes
  109. * {@link #visitReferenceType visitReferenceType}.
  110. * @param t the type to visit
  111. */
  112. public void visitArrayType(ArrayType t) {
  113. visitReferenceType(t);
  114. }
  115. /**
  116. * Visits a type variable.
  117. * The implementation simply invokes
  118. * {@link #visitReferenceType visitReferenceType}.
  119. * @param t the type to visit
  120. */
  121. public void visitTypeVariable(TypeVariable t) {
  122. visitReferenceType(t);
  123. }
  124. /**
  125. * Visits a wildcard.
  126. * The implementation simply invokes
  127. * {@link #visitTypeMirror visitTypeMirror}.
  128. * @param t the type to visit
  129. */
  130. public void visitWildcardType(WildcardType t) {
  131. visitTypeMirror(t);
  132. }
  133. }