当前位置: 首页>>代码示例>>Java>>正文


Java ClassRepository.getSuperInterfaces方法代码示例

本文整理汇总了Java中sun.reflect.generics.repository.ClassRepository.getSuperInterfaces方法的典型用法代码示例。如果您正苦于以下问题:Java ClassRepository.getSuperInterfaces方法的具体用法?Java ClassRepository.getSuperInterfaces怎么用?Java ClassRepository.getSuperInterfaces使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sun.reflect.generics.repository.ClassRepository的用法示例。


在下文中一共展示了ClassRepository.getSuperInterfaces方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getGenericInterfaces

import sun.reflect.generics.repository.ClassRepository; //导入方法依赖的package包/类
/**
 * Returns the {@code Type}s representing the interfaces
 * directly implemented by the class or interface represented by
 * this object.
 *
 * <p>If a superinterface is a parameterized type, the
 * {@code Type} object returned for it must accurately reflect
 * the actual type parameters used in the source code. The
 * parameterized type representing each superinterface 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.
 *
 * <p> If this object represents a class, the return value is an
 * array containing objects representing all interfaces
 * implemented by the class. The order of the interface objects in
 * the array corresponds to the order of the interface names in
 * the {@code implements} clause of the declaration of the class
 * represented by this object.  In the case of an array class, the
 * interfaces {@code Cloneable} and {@code Serializable} are
 * returned in that order.
 *
 * <p>If this object represents an interface, the array contains
 * objects representing all interfaces directly extended by the
 * interface.  The order of the interface objects in the array
 * corresponds to the order of the interface names in the
 * {@code extends} clause of the declaration of the interface
 * represented by this object.
 *
 * <p>If this object represents a class or interface that
 * implements no interfaces, the method returns an array of length
 * 0.
 *
 * <p>If this object represents a primitive type or void, the
 * method returns an array of length 0.
 *
 * @throws java.lang.reflect.GenericSignatureFormatError
 *     if the generic class signature does not conform to the format
 *     specified in
 *     <cite>The Java&trade; Virtual Machine Specification</cite>
 * @throws TypeNotPresentException if any of the generic
 *     superinterfaces refers to a non-existent type declaration
 * @throws java.lang.reflect.MalformedParameterizedTypeException
 *     if any of the generic superinterfaces refer to a parameterized
 *     type that cannot be instantiated for any reason
 * @return an array of interfaces implemented by this class
 * @since 1.5
 */
public Type[] getGenericInterfaces() {
    ClassRepository info = getGenericInfo();
    return (info == null) ?  getInterfaces() : info.getSuperInterfaces();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:54,代码来源:Class.java

示例2: getGenericInterfaces

import sun.reflect.generics.repository.ClassRepository; //导入方法依赖的package包/类
/**
 * Returns the {@code Type}s representing the interfaces
 * directly implemented by the class or interface represented by
 * this object.
 *
 * <p>If a superinterface is a parameterized type, the
 * {@code Type} object returned for it must accurately reflect
 * the actual type parameters used in the source code. The
 * parameterized type representing each superinterface 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.
 *
 * <p>If this object represents a class, the return value is an array
 * containing objects representing all interfaces directly implemented by
 * the class.  The order of the interface objects in the array corresponds
 * to the order of the interface names in the {@code implements} clause of
 * the declaration of the class represented by this object.
 *
 * <p>If this object represents an interface, the array contains objects
 * representing all interfaces directly extended by the interface.  The
 * order of the interface objects in the array corresponds to the order of
 * the interface names in the {@code extends} clause of the declaration of
 * the interface represented by this object.
 *
 * <p>If this object represents a class or interface that implements no
 * interfaces, the method returns an array of length 0.
 *
 * <p>If this object represents a primitive type or void, the method
 * returns an array of length 0.
 *
 * <p>If this {@code Class} object represents an array type, the
 * interfaces {@code Cloneable} and {@code java.io.Serializable} are
 * returned in that order.
 *
 * @throws java.lang.reflect.GenericSignatureFormatError
 *     if the generic class signature does not conform to the format
 *     specified in
 *     <cite>The Java&trade; Virtual Machine Specification</cite>
 * @throws TypeNotPresentException if any of the generic
 *     superinterfaces refers to a non-existent type declaration
 * @throws java.lang.reflect.MalformedParameterizedTypeException
 *     if any of the generic superinterfaces refer to a parameterized
 *     type that cannot be instantiated for any reason
 * @return an array of interfaces directly implemented by this class
 * @since 1.5
 */
public Type[] getGenericInterfaces() {
    ClassRepository info = getGenericInfo();
    return (info == null) ?  getInterfaces() : info.getSuperInterfaces();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:53,代码来源:Class.java


注:本文中的sun.reflect.generics.repository.ClassRepository.getSuperInterfaces方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。