1 11 12 package org.eclipse.jdt.internal.compiler.apt.model; 13 14 import javax.lang.model.type.NoType; 15 import javax.lang.model.type.NullType; 16 import javax.lang.model.type.TypeKind; 17 import javax.lang.model.type.TypeVisitor; 18 19 23 public class NoTypeImpl implements NoType, NullType 24 { 25 private final TypeKind _kind; 26 27 public static final NoType NO_TYPE_NONE = new NoTypeImpl(TypeKind.NONE); 28 public static final NoType NO_TYPE_VOID = new NoTypeImpl(TypeKind.VOID); 29 public static final NoType NO_TYPE_PACKAGE = new NoTypeImpl(TypeKind.PACKAGE); 30 public static final NullType NULL_TYPE = new NoTypeImpl(TypeKind.NULL); 31 32 private NoTypeImpl(TypeKind kind) { 33 _kind = kind; 34 } 35 36 @Override 37 public <R, P> R accept(TypeVisitor<R, P> v, P p) 38 { 39 switch(this.getKind()) 40 { 41 case NULL : 42 return v.visitNull(this, p); 43 default: 44 return v.visitNoType(this, p); 45 } 46 } 47 48 @Override 49 public TypeKind getKind() 50 { 51 return _kind; 52 } 53 54 public String toString() 55 { 56 switch (_kind) { 57 default: 58 case NONE: 59 return "<none>"; case NULL: 61 return "null"; case VOID: 63 return "void"; case PACKAGE: 65 return "package"; } 67 } 68 69 } 70 | Popular Tags |