Beispiel #1
0
 public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
   if (value instanceof String) return v.visitString((String) value, p);
   if (value instanceof Integer) {
     int i = (Integer) value;
     switch (type.tag) {
       case BOOLEAN:
         return v.visitBoolean(i != 0, p);
       case CHAR:
         return v.visitChar((char) i, p);
       case BYTE:
         return v.visitByte((byte) i, p);
       case SHORT:
         return v.visitShort((short) i, p);
       case INT:
         return v.visitInt(i, p);
     }
   }
   switch (type.tag) {
     case LONG:
       return v.visitLong((Long) value, p);
     case FLOAT:
       return v.visitFloat((Float) value, p);
     case DOUBLE:
       return v.visitDouble((Double) value, p);
   }
   throw new AssertionError("Bad annotation element value: " + value);
 }
 @SuppressWarnings("unchecked")
 @Override
 public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
   if (value instanceof AnnotationMirror) {
     return v.visitAnnotation((AnnotationMirror) value, p);
   } else if (value instanceof List<?>) {
     return v.visitArray((List<? extends AnnotationValue>) value, p);
   } else if (value instanceof Boolean) {
     return v.visitBoolean((boolean) value, p);
   } else if (value instanceof Byte) {
     return v.visitByte((byte) value, p);
   } else if (value instanceof Character) {
     return v.visitChar((char) value, p);
   } else if (value instanceof Double) {
     return v.visitDouble((double) value, p);
   } else if (value instanceof VariableElement) {
     return v.visitEnumConstant((VariableElement) value, p);
   } else if (value instanceof Float) {
     return v.visitFloat((float) value, p);
   } else if (value instanceof Integer) {
     return v.visitInt((int) value, p);
   } else if (value instanceof Long) {
     return v.visitLong((long) value, p);
   } else if (value instanceof Short) {
     return v.visitShort((short) value, p);
   } else if (value instanceof String) {
     return v.visitString((String) value, p);
   } else if (value instanceof TypeMirror) {
     return v.visitType((TypeMirror) value, p);
   } else {
     return v.visitUnknown(this, p);
   }
 }
Beispiel #3
0
 public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
   return v.visitString(toString(), p);
 }
Beispiel #4
0
 public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
   return v.visitEnumConstant(value, p);
 }
Beispiel #5
0
 public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
   return v.visitArray(getValue(), p);
 }
Beispiel #6
0
 public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
   return v.visitAnnotation(this, p);
 }
Beispiel #7
0
 public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
   return v.visitType(type, p);
 }