本文整理汇总了Java中javax.lang.model.element.AnnotationValueVisitor.visitEnumConstant方法的典型用法代码示例。如果您正苦于以下问题:Java AnnotationValueVisitor.visitEnumConstant方法的具体用法?Java AnnotationValueVisitor.visitEnumConstant怎么用?Java AnnotationValueVisitor.visitEnumConstant使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.lang.model.element.AnnotationValueVisitor
的用法示例。
在下文中一共展示了AnnotationValueVisitor.visitEnumConstant方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: accept
import javax.lang.model.element.AnnotationValueVisitor; //导入方法依赖的package包/类
@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));
}
}
示例2: accept
import javax.lang.model.element.AnnotationValueVisitor; //导入方法依赖的package包/类
@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;
}
}
示例3: accept
import javax.lang.model.element.AnnotationValueVisitor; //导入方法依赖的package包/类
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
return v.visitEnumConstant(value, p);
}
示例4: accept
import javax.lang.model.element.AnnotationValueVisitor; //导入方法依赖的package包/类
@DefinedBy(Api.LANGUAGE_MODEL)
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
return v.visitEnumConstant(value, p);
}