1 7 8 package javax.lang.model.util; 9 10 11 import javax.lang.model.type.*; 12 import javax.annotation.processing.SupportedSourceVersion; 13 import static javax.lang.model.element.ElementKind.*; 14 import static javax.lang.model.SourceVersion.*; 15 import javax.lang.model.SourceVersion; 16 17 62 @SupportedSourceVersion(RELEASE_6) 63 public class TypeKindVisitor6<R, P> extends SimpleTypeVisitor6<R, P> { 64 68 protected TypeKindVisitor6() { 69 super(null); 70 } 71 72 73 79 protected TypeKindVisitor6(R defaultValue) { 80 super(defaultValue); 81 } 82 83 92 @Override 93 public R visitPrimitive(PrimitiveType t, P p) { 94 TypeKind k = t.getKind(); 95 switch (k) { 96 case BOOLEAN: 97 return visitPrimitiveAsBoolean(t, p); 98 99 case BYTE: 100 return visitPrimitiveAsByte(t, p); 101 102 case SHORT: 103 return visitPrimitiveAsShort(t, p); 104 105 case INT: 106 return visitPrimitiveAsInt(t, p); 107 108 case LONG: 109 return visitPrimitiveAsLong(t, p); 110 111 case CHAR: 112 return visitPrimitiveAsChar(t, p); 113 114 case FLOAT: 115 return visitPrimitiveAsFloat(t, p); 116 117 case DOUBLE: 118 return visitPrimitiveAsDouble(t, p); 119 120 default: 121 throw new AssertionError ("Bad kind " + k + " for PrimitiveType" + t); 122 } 123 } 124 125 133 public R visitPrimitiveAsBoolean(PrimitiveType t, P p) { 134 return defaultAction(t, p); 135 } 136 137 145 public R visitPrimitiveAsByte(PrimitiveType t, P p) { 146 return defaultAction(t, p); 147 } 148 149 157 public R visitPrimitiveAsShort(PrimitiveType t, P p) { 158 return defaultAction(t, p); 159 } 160 161 169 public R visitPrimitiveAsInt(PrimitiveType t, P p) { 170 return defaultAction(t, p); 171 } 172 173 181 public R visitPrimitiveAsLong(PrimitiveType t, P p) { 182 return defaultAction(t, p); 183 } 184 185 193 public R visitPrimitiveAsChar(PrimitiveType t, P p) { 194 return defaultAction(t, p); 195 } 196 197 205 public R visitPrimitiveAsFloat(PrimitiveType t, P p) { 206 return defaultAction(t, p); 207 } 208 209 217 public R visitPrimitiveAsDouble(PrimitiveType t, P p) { 218 return defaultAction(t, p); 219 } 220 221 230 @Override 231 public R visitNoType(NoType t, P p) { 232 TypeKind k = t.getKind(); 233 switch (k) { 234 case VOID: 235 return visitNoTypeAsVoid(t, p); 236 237 case PACKAGE: 238 return visitNoTypeAsPackage(t, p); 239 240 case NONE: 241 return visitNoTypeAsNone(t, p); 242 243 default: 244 throw new AssertionError ("Bad kind " + k + " for NoType" + t); 245 } 246 } 247 248 256 public R visitNoTypeAsVoid(NoType t, P p) { 257 return defaultAction(t, p); 258 } 259 260 268 public R visitNoTypeAsPackage(NoType t, P p) { 269 return defaultAction(t, p); 270 } 271 272 280 public R visitNoTypeAsNone(NoType t, P p) { 281 return defaultAction(t, p); 282 } 283 } 284 | Popular Tags |