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); }
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.getTag()) { 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.getTag()) { 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); }
@DefinedBy(Api.LANGUAGE_MODEL) 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.getTag()) { 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.getTag()) { 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); }
@Override public <R, P> R accept(AnnotationValueVisitor<R, P> v, @Nullable P p) { Object underlyingValue = underlyingAnnotationValue.getValue(); Object value = getValue(); if (underlyingValue.equals(value)) { return underlyingAnnotationValue.accept(v, p); } if (value instanceof TreeBackedVariableElement) { return v.visitEnumConstant((TreeBackedVariableElement) value, p); } else if (value instanceof TypeMirror) { return v.visitType((TypeMirror) value, p); } else if (value instanceof TreeBackedAnnotationMirror) { return v.visitAnnotation((TreeBackedAnnotationMirror) value, p); } else if (value instanceof List) { @SuppressWarnings("unchecked") List<? extends AnnotationValue> valuesList = (List<? extends AnnotationValue>) value; return v.visitArray(valuesList, p); } else { throw new IllegalStateException(String.format("Unexpected annotation value: %s", value)); } }
@SuppressWarnings("unchecked") // Need to cast Object _value to a List<AnnotationValue> @Override public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) { switch (_kind) { case TypeIds.T_boolean: return v.visitBoolean((Boolean)_value, p); case TypeIds.T_byte: return v.visitByte((Byte)_value, p); case TypeIds.T_char: return v.visitChar((Character)_value, p); case TypeIds.T_double: return v.visitDouble((Double)_value, p); case TypeIds.T_float: return v.visitFloat((Float)_value, p); case TypeIds.T_int: return v.visitInt((Integer)_value, p); case TypeIds.T_JavaLangString: return v.visitString((String)_value, p); case TypeIds.T_long: return v.visitLong((Long)_value, p); case TypeIds.T_short: return v.visitShort((Short)_value, p); case T_EnumConstant: return v.visitEnumConstant((VariableElement)_value, p); case T_ClassObject: return v.visitType((TypeMirror)_value, p); case T_AnnotationMirror: return v.visitAnnotation((AnnotationMirror)_value, p); case T_ArrayType: return v.visitArray((List<AnnotationValue>)_value, p); default: return null; } }
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) { throw new UnsupportedOperationException(); }
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) { return v.visitType(type, p); }
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) { return v.visitAnnotation(this, p); }
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) { return v.visitArray(getValue(), p); }
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) { return v.visitEnumConstant(value, p); }
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) { return v.visitString(toString(), p); }
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) { return v.visitType(classType, p); }
@DefinedBy(Api.LANGUAGE_MODEL) public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) { throw new UnsupportedOperationException(); }
@DefinedBy(Api.LANGUAGE_MODEL) public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) { return v.visitType(classType, p); }
@DefinedBy(Api.LANGUAGE_MODEL) public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) { return v.visitAnnotation(this, p); }
@DefinedBy(Api.LANGUAGE_MODEL) public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) { return v.visitArray(getValue(), p); }
@DefinedBy(Api.LANGUAGE_MODEL) public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) { return v.visitEnumConstant(value, p); }
@DefinedBy(Api.LANGUAGE_MODEL) public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) { return v.visitString(toString(), p); }