本文整理汇总了Java中sun.reflect.generics.repository.ClassRepository类的典型用法代码示例。如果您正苦于以下问题:Java ClassRepository类的具体用法?Java ClassRepository怎么用?Java ClassRepository使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClassRepository类属于sun.reflect.generics.repository包,在下文中一共展示了ClassRepository类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getGenericInfo
import sun.reflect.generics.repository.ClassRepository; //导入依赖的package包/类
private ClassRepository getGenericInfo() {
ClassRepository genericInfo = this.genericInfo;
if (genericInfo == null) {
String signature = getGenericSignature0();
if (signature == null) {
genericInfo = ClassRepository.NONE;
} else {
genericInfo = ClassRepository.make(signature, getFactory());
}
this.genericInfo = genericInfo;
}
return (genericInfo != ClassRepository.NONE) ? genericInfo : null;
}
示例2: getGenericInfo
import sun.reflect.generics.repository.ClassRepository; //导入依赖的package包/类
private ClassRepository getGenericInfo() {
// lazily initialize repository if necessary
if (genericInfo == null) {
// create and cache generic info repository
genericInfo = ClassRepository.make(getGenericSignature(),
getFactory());
}
return genericInfo; //return cached repository
}
示例3: getGenericInfo
import sun.reflect.generics.repository.ClassRepository; //导入依赖的package包/类
private ClassRepository getGenericInfo() {
// lazily initialize repository if necessary
if (genericInfo == null) {
// create and cache generic info repository
genericInfo = ClassRepository.make(getGenericSignature(),
getFactory());
}
return genericInfo; //return cached repository
}
示例4: getGenericSuperclass
import sun.reflect.generics.repository.ClassRepository; //导入依赖的package包/类
/**
* Returns the {@code Type} representing the direct superclass of
* the entity (class, interface, primitive type or void) represented by
* this {@code Class}.
*
* <p>If the superclass is a parameterized type, the {@code Type}
* object returned must accurately reflect the actual type
* parameters used in the source code. The parameterized type
* representing the superclass is created if it had not been
* created before. See the declaration of {@link
* java.lang.reflect.ParameterizedType ParameterizedType} for the
* semantics of the creation process for parameterized types. If
* this {@code Class} represents either the {@code Object}
* class, an interface, a primitive type, or void, then null is
* returned. If this object represents an array class then the
* {@code Class} object representing the {@code Object} class is
* returned.
*
* @throws java.lang.reflect.GenericSignatureFormatError if the generic
* class signature does not conform to the format specified in
* <cite>The Java™ Virtual Machine Specification</cite>
* @throws TypeNotPresentException if the generic superclass
* refers to a non-existent type declaration
* @throws java.lang.reflect.MalformedParameterizedTypeException if the
* generic superclass refers to a parameterized type that cannot be
* instantiated for any reason
* @return the superclass of the class represented by this object
* @since 1.5
*/
public Type getGenericSuperclass() {
ClassRepository info = getGenericInfo();
if (info == null) {
return getSuperclass();
}
// Historical irregularity:
// Generic signature marks interfaces with superclass = Object
// but this API returns null for interfaces
if (isInterface()) {
return null;
}
return info.getSuperclass();
}
示例5: getGenericSuperclass
import sun.reflect.generics.repository.ClassRepository; //导入依赖的package包/类
/**
* Returns the {@code Type} representing the direct superclass of
* the entity (class, interface, primitive type or void) represented by
* this {@code Class}.
*
* <p>If the superclass is a parameterized type, the {@code Type}
* object returned must accurately reflect the actual type
* parameters used in the source code. The parameterized type
* representing the superclass is created if it had not been
* created before. See the declaration of {@link
* java.lang.reflect.ParameterizedType ParameterizedType} for the
* semantics of the creation process for parameterized types. If
* this {@code Class} represents either the {@code Object}
* class, an interface, a primitive type, or void, then null is
* returned. If this object represents an array class then the
* {@code Class} object representing the {@code Object} class is
* returned.
*
* @throws java.lang.reflect.GenericSignatureFormatError if the generic
* class signature does not conform to the format specified in
* <cite>The Java™ Virtual Machine Specification</cite>
* @throws TypeNotPresentException if the generic superclass
* refers to a non-existent type declaration
* @throws java.lang.reflect.MalformedParameterizedTypeException if the
* generic superclass refers to a parameterized type that cannot be
* instantiated for any reason
* @return the direct superclass of the class represented by this object
* @since 1.5
*/
public Type getGenericSuperclass() {
ClassRepository info = getGenericInfo();
if (info == null) {
return getSuperclass();
}
// Historical irregularity:
// Generic signature marks interfaces with superclass = Object
// but this API returns null for interfaces
if (isInterface()) {
return null;
}
return info.getSuperclass();
}
示例6: getTypeParameters
import sun.reflect.generics.repository.ClassRepository; //导入依赖的package包/类
/**
* Returns an array of {@code TypeVariable} objects that represent the
* type variables declared by the generic declaration represented by this
* {@code GenericDeclaration} object, in declaration order. Returns an
* array of length 0 if the underlying generic declaration declares no type
* variables.
*
* @return an array of {@code TypeVariable} objects that represent
* the type variables declared by this generic declaration
* @throws java.lang.reflect.GenericSignatureFormatError if the generic
* signature of this generic declaration does not conform to
* the format specified in
* <cite>The Java™ Virtual Machine Specification</cite>
* @since 1.5
*/
@SuppressWarnings("unchecked")
public TypeVariable<Class<T>>[] getTypeParameters() {
ClassRepository info = getGenericInfo();
if (info != null)
return (TypeVariable<Class<T>>[])info.getTypeParameters();
else
return (TypeVariable<Class<T>>[])new TypeVariable<?>[0];
}