本文整理汇总了Java中sun.reflect.annotation.AnnotationParser.parseMemberValue方法的典型用法代码示例。如果您正苦于以下问题:Java AnnotationParser.parseMemberValue方法的具体用法?Java AnnotationParser.parseMemberValue怎么用?Java AnnotationParser.parseMemberValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.reflect.annotation.AnnotationParser
的用法示例。
在下文中一共展示了AnnotationParser.parseMemberValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDefaultValue
import sun.reflect.annotation.AnnotationParser; //导入方法依赖的package包/类
/**
* Returns the default value for the annotation member represented by
* this {@code Method} instance. If the member is of a primitive type,
* an instance of the corresponding wrapper type is returned. Returns
* null if no default is associated with the member, or if the method
* instance does not represent a declared member of an annotation type.
*
* @return the default value for the annotation member represented
* by this {@code Method} instance.
* @throws TypeNotPresentException if the annotation is of type
* {@link Class} and no definition can be found for the
* default class value.
* @since 1.5
*/
public Object getDefaultValue() {
if (annotationDefault == null)
return null;
Class<?> memberType = AnnotationType.invocationHandlerReturnType(
getReturnType());
Object result = AnnotationParser.parseMemberValue(
memberType, ByteBuffer.wrap(annotationDefault),
SharedSecrets.getJavaLangAccess().
getConstantPool(getDeclaringClass()),
getDeclaringClass());
if (result instanceof ExceptionProxy) {
if (result instanceof TypeNotPresentExceptionProxy) {
TypeNotPresentExceptionProxy proxy = (TypeNotPresentExceptionProxy)result;
throw new TypeNotPresentException(proxy.typeName(), proxy.getCause());
}
throw new AnnotationFormatError("Invalid default: " + this);
}
return result;
}
示例2: getDefaultValue
import sun.reflect.annotation.AnnotationParser; //导入方法依赖的package包/类
/**
* Returns the default value for the annotation member represented by
* this {@code Method} instance. If the member is of a primitive type,
* an instance of the corresponding wrapper type is returned. Returns
* null if no default is associated with the member, or if the method
* instance does not represent a declared member of an annotation type.
*
* @return the default value for the annotation member represented
* by this {@code Method} instance.
* @throws TypeNotPresentException if the annotation is of type
* {@link Class} and no definition can be found for the
* default class value.
* @since 1.5
*/
public Object getDefaultValue() {
if (annotationDefault == null)
return null;
Class<?> memberType = AnnotationType.invocationHandlerReturnType(
getReturnType());
Object result = AnnotationParser.parseMemberValue(
memberType, ByteBuffer.wrap(annotationDefault),
sun.misc.SharedSecrets.getJavaLangAccess().
getConstantPool(getDeclaringClass()),
getDeclaringClass());
if (result instanceof sun.reflect.annotation.ExceptionProxy)
throw new AnnotationFormatError("Invalid default: " + this);
return result;
}
示例3: getDefaultValue
import sun.reflect.annotation.AnnotationParser; //导入方法依赖的package包/类
/**
* Returns the default value for the annotation member represented by
* this {@code Method} instance. If the member is of a primitive type,
* an instance of the corresponding wrapper type is returned. Returns
* null if no default is associated with the member, or if the method
* instance does not represent a declared member of an annotation type.
*
* @return the default value for the annotation member represented
* by this {@code Method} instance.
* @throws TypeNotPresentException if the annotation is of type
* {@link Class} and no definition can be found for the
* default class value.
* @since 1.5
*/
public Object getDefaultValue() {
if (annotationDefault == null)
return null;
Class<?> memberType = AnnotationType.invocationHandlerReturnType(
getReturnType());
Object result = AnnotationParser.parseMemberValue(
memberType, ByteBuffer.wrap(annotationDefault),
SharedSecrets.getJavaLangAccess().
getConstantPool(getDeclaringClass()),
getDeclaringClass());
if (result instanceof sun.reflect.annotation.ExceptionProxy)
throw new AnnotationFormatError("Invalid default: " + this);
return result;
}
示例4: getDefaultValue
import sun.reflect.annotation.AnnotationParser; //导入方法依赖的package包/类
/**
* Returns the default value for the annotation member represented by
* this <tt>Method</tt> instance. If the member is of a primitive type,
* an instance of the corresponding wrapper type is returned. Returns
* null if no default is associated with the member, or if the method
* instance does not represent a declared member of an annotation type.
*
* @return the default value for the annotation member represented
* by this <tt>Method</tt> instance.
* @throws TypeNotPresentException if the annotation is of type
* {@link Class} and no definition can be found for the
* default class value.
* @since 1.5
*/
public Object getDefaultValue() {
if (annotationDefault == null)
return null;
Class memberType = AnnotationType.invocationHandlerReturnType(
getReturnType());
Object result = AnnotationParser.parseMemberValue(
memberType, ByteBuffer.wrap(annotationDefault),
sun.misc.SharedSecrets.getJavaLangAccess().
getConstantPool(getDeclaringClass()),
getDeclaringClass());
if (result instanceof sun.reflect.annotation.ExceptionProxy)
throw new AnnotationFormatError("Invalid default: " + this);
return result;
}