예제 #1
0
  String qualifiedTypeName(TypeMirror type) {
    TypeVisitor<Name, Void> v =
        new SimpleTypeVisitor8<Name, Void>() {
          @Override
          public Name visitArray(ArrayType t, Void p) {
            return t.getComponentType().accept(this, p);
          }

          @Override
          public Name visitDeclared(DeclaredType t, Void p) {
            return ((TypeElement) t.asElement()).getQualifiedName();
          }

          @Override
          public Name visitPrimitive(PrimitiveType t, Void p) {
            return elems.getName(t.toString());
          }

          @Override
          public Name visitNoType(NoType t, Void p) {
            if (t.getKind() == TypeKind.VOID) return elems.getName("void");
            return defaultAction(t, p);
          }

          @Override
          public Name visitTypeVariable(TypeVariable t, Void p) {
            return t.getUpperBound().accept(this, p);
          }
        };
    return v.visit(type).toString();
  }
예제 #2
0
 @Override
 public <R, P> R accept(TypeVisitor<R, P> typeVisitor, P p) {
   return typeVisitor.visitError(this, p);
 }
예제 #3
0
 public <R, P> R accept(TypeVisitor<R, P> v, P p) {
   return v.visitExecutable(this, p);
 }
예제 #4
0
 @Override
 public <R, P> R accept(TypeVisitor<R, P> v, P p) {
   return v.visitTypeVariable(this, p);
 }
예제 #5
0
 /* (non-Javadoc)
  * @see javax.lang.model.type.TypeMirror#accept(javax.lang.model.type.TypeVisitor, java.lang.Object)
  */
 @Override
 public <R, P> R accept(TypeVisitor<R, P> v, P p) {
   return v.visitArray(this, p);
 }