本文整理汇总了Java中sun.reflect.annotation.TypeAnnotation类的典型用法代码示例。如果您正苦于以下问题:Java TypeAnnotation类的具体用法?Java TypeAnnotation怎么用?Java TypeAnnotation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TypeAnnotation类属于sun.reflect.annotation包,在下文中一共展示了TypeAnnotation类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAnnotatedReceiverType
import sun.reflect.annotation.TypeAnnotation; //导入依赖的package包/类
/**
* {@inheritDoc}
* @since 1.8
*/
@Override
public AnnotatedType getAnnotatedReceiverType() {
if (getDeclaringClass().getEnclosingClass() == null)
return super.getAnnotatedReceiverType();
return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(),
sun.misc.SharedSecrets.getJavaLangAccess().
getConstantPool(getDeclaringClass()),
this,
getDeclaringClass(),
getDeclaringClass().getEnclosingClass(),
TypeAnnotation.TypeAnnotationTarget.METHOD_RECEIVER);
}
示例2: getAnnotatedReturnType0
import sun.reflect.annotation.TypeAnnotation; //导入依赖的package包/类
AnnotatedType getAnnotatedReturnType0(Type returnType) {
return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(),
sun.misc.SharedSecrets.getJavaLangAccess().
getConstantPool(getDeclaringClass()),
this,
getDeclaringClass(),
returnType,
TypeAnnotation.TypeAnnotationTarget.METHOD_RETURN);
}
示例3: getAnnotatedType
import sun.reflect.annotation.TypeAnnotation; //导入依赖的package包/类
/**
* Returns an AnnotatedType object that represents the use of a type to specify
* the declared type of the field represented by this Field.
* @return an object representing the declared type of the field
* represented by this Field
*
* @since 1.8
*/
public AnnotatedType getAnnotatedType() {
return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(),
sun.misc.SharedSecrets.getJavaLangAccess().
getConstantPool(getDeclaringClass()),
this,
getDeclaringClass(),
getGenericType(),
TypeAnnotation.TypeAnnotationTarget.FIELD);
}
示例4: getAnnotatedReceiverType
import sun.reflect.annotation.TypeAnnotation; //导入依赖的package包/类
/**
* {@inheritDoc}
* @since 1.8
*/
@Override
public AnnotatedType getAnnotatedReceiverType() {
Class<?> thisDeclClass = getDeclaringClass();
Class<?> enclosingClass = thisDeclClass.getEnclosingClass();
if (enclosingClass == null) {
// A Constructor for a top-level class
return null;
}
Class<?> outerDeclaringClass = thisDeclClass.getDeclaringClass();
if (outerDeclaringClass == null) {
// A constructor for a local or anonymous class
return null;
}
// Either static nested or inner class
if (Modifier.isStatic(thisDeclClass.getModifiers())) {
// static nested
return null;
}
// A Constructor for an inner class
return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(),
SharedSecrets.getJavaLangAccess().
getConstantPool(thisDeclClass),
this,
thisDeclClass,
enclosingClass,
TypeAnnotation.TypeAnnotationTarget.METHOD_RECEIVER);
}
示例5: getAnnotatedReturnType0
import sun.reflect.annotation.TypeAnnotation; //导入依赖的package包/类
AnnotatedType getAnnotatedReturnType0(Type returnType) {
return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(),
SharedSecrets.getJavaLangAccess().
getConstantPool(getDeclaringClass()),
this,
getDeclaringClass(),
returnType,
TypeAnnotation.TypeAnnotationTarget.METHOD_RETURN);
}
示例6: getAnnotatedType
import sun.reflect.annotation.TypeAnnotation; //导入依赖的package包/类
/**
* Returns an AnnotatedType object that represents the use of a type to specify
* the declared type of the field represented by this Field.
* @return an object representing the declared type of the field
* represented by this Field
*
* @since 1.8
*/
public AnnotatedType getAnnotatedType() {
return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(),
SharedSecrets.getJavaLangAccess().
getConstantPool(getDeclaringClass()),
this,
getDeclaringClass(),
getGenericType(),
TypeAnnotation.TypeAnnotationTarget.FIELD);
}
示例7: getAnnotatedReceiverType
import sun.reflect.annotation.TypeAnnotation; //导入依赖的package包/类
/**
* Returns an {@code AnnotatedType} object that represents the use of a
* type to specify the receiver type of the method/constructor represented
* by this Executable object. The receiver type of a method/constructor is
* available only if the method/constructor has a <em>receiver
* parameter</em> (JLS 8.4.1).
*
* If this {@code Executable} object represents a constructor or instance
* method that does not have a receiver parameter, or has a receiver
* parameter with no annotations on its type, then the return value is an
* {@code AnnotatedType} object representing an element with no
* annotations.
*
* If this {@code Executable} object represents a static method, then the
* return value is null.
*
* @return an object representing the receiver type of the method or
* constructor represented by this {@code Executable}
*
* @since 1.8
*/
public AnnotatedType getAnnotatedReceiverType() {
if (Modifier.isStatic(this.getModifiers()))
return null;
return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(),
sun.misc.SharedSecrets.getJavaLangAccess().
getConstantPool(getDeclaringClass()),
this,
getDeclaringClass(),
getDeclaringClass(),
TypeAnnotation.TypeAnnotationTarget.METHOD_RECEIVER);
}
示例8: getAnnotatedParameterTypes
import sun.reflect.annotation.TypeAnnotation; //导入依赖的package包/类
/**
* Returns an array of {@code AnnotatedType} objects that represent the use
* of types to specify formal parameter types of the method/constructor
* represented by this Executable. The order of the objects in the array
* corresponds to the order of the formal parameter types in the
* declaration of the method/constructor.
*
* Returns an array of length 0 if the method/constructor declares no
* parameters.
*
* @return an array of objects representing the types of the
* formal parameters of the method or constructor represented by this
* {@code Executable}
*
* @since 1.8
*/
public AnnotatedType[] getAnnotatedParameterTypes() {
return TypeAnnotationParser.buildAnnotatedTypes(getTypeAnnotationBytes0(),
sun.misc.SharedSecrets.getJavaLangAccess().
getConstantPool(getDeclaringClass()),
this,
getDeclaringClass(),
getAllGenericParameterTypes(),
TypeAnnotation.TypeAnnotationTarget.METHOD_FORMAL_PARAMETER);
}
示例9: getAnnotatedExceptionTypes
import sun.reflect.annotation.TypeAnnotation; //导入依赖的package包/类
/**
* Returns an array of {@code AnnotatedType} objects that represent the use
* of types to specify the declared exceptions of the method/constructor
* represented by this Executable. The order of the objects in the array
* corresponds to the order of the exception types in the declaration of
* the method/constructor.
*
* Returns an array of length 0 if the method/constructor declares no
* exceptions.
*
* @return an array of objects representing the declared
* exceptions of the method or constructor represented by this {@code
* Executable}
*
* @since 1.8
*/
public AnnotatedType[] getAnnotatedExceptionTypes() {
return TypeAnnotationParser.buildAnnotatedTypes(getTypeAnnotationBytes0(),
sun.misc.SharedSecrets.getJavaLangAccess().
getConstantPool(getDeclaringClass()),
this,
getDeclaringClass(),
getGenericExceptionTypes(),
TypeAnnotation.TypeAnnotationTarget.THROWS);
}