Java Code Examples for javax.lang.model.element.AnnotationValueVisitor#visitAnnotation()

The following examples show how to use javax.lang.model.element.AnnotationValueVisitor#visitAnnotation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TreeBackedAnnotationValue.java    From buck with Apache License 2.0 6 votes vote down vote up
@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));
  }
}
 
Example 2
Source File: AnnotationValueImpl.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@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;
	}
}
 
Example 3
Source File: Attribute.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
    return v.visitAnnotation(this, p);
}
 
Example 4
Source File: Attribute.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
    return v.visitAnnotation(this, p);
}
 
Example 5
Source File: Attribute.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
    return v.visitAnnotation(this, p);
}
 
Example 6
Source File: Attribute.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
    return v.visitAnnotation(this, p);
}
 
Example 7
Source File: Attribute.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@DefinedBy(Api.LANGUAGE_MODEL)
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
    return v.visitAnnotation(this, p);
}
 
Example 8
Source File: Attribute.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
    return v.visitAnnotation(this, p);
}
 
Example 9
Source File: Attribute.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
    return v.visitAnnotation(this, p);
}
 
Example 10
Source File: Attribute.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@DefinedBy(Api.LANGUAGE_MODEL)
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
    return v.visitAnnotation(this, p);
}
 
Example 11
Source File: Attribute.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
    return v.visitAnnotation(this, p);
}
 
Example 12
Source File: Attribute.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
    return v.visitAnnotation(this, p);
}
 
Example 13
Source File: TurbineAnnotationMirror.java    From turbine with Apache License 2.0 4 votes vote down vote up
@Override
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
  return v.visitAnnotation(getValue(), p);
}
 
Example 14
Source File: Attribute.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
    return v.visitAnnotation(this, p);
}