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

The following examples show how to use javax.lang.model.element.AnnotationValueVisitor#visitInt() . 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: Attribute.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 2
Source File: Attribute.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 3
Source File: Attribute.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example 4
Source File: Attribute.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 5
Source File: Attribute.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@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);
}
 
Example 6
Source File: Attribute.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 7
Source File: Attribute.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
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);
}
 
Example 8
Source File: Attribute.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@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);
}
 
Example 9
Source File: Attribute.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 10
Source File: Attribute.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 11
Source File: Attribute.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 12
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 13
Source File: SimpleAnnotationMirrorTest.java    From auto with Apache License 2.0 5 votes vote down vote up
private static AnnotationValue intValue(int value) {
  return new AnnotationValue() {
    @Override
    public Object getValue() {
      return value;
    }

    @Override
    public <R, P> R accept(AnnotationValueVisitor<R, P> annotationValueVisitor, P p) {
      return annotationValueVisitor.visitInt(value, p);
    }
  };
}
 
Example 14
Source File: Const.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.visitInt(value, p);
}