jdk/src/share/classes/sun/reflect/generics/repository/ClassRepository.java

Print this page




  23  * questions.
  24  */
  25 
  26 package sun.reflect.generics.repository;
  27 
  28 import sun.reflect.generics.factory.GenericsFactory;
  29 import sun.reflect.generics.tree.ClassSignature;
  30 import sun.reflect.generics.tree.TypeTree;
  31 import sun.reflect.generics.visitor.Reifier;
  32 import sun.reflect.generics.parser.SignatureParser;
  33 import java.lang.reflect.Type;
  34 
  35 
  36 /**
  37  * This class represents the generic type information for a class.
  38  * The code is not dependent on a particular reflective implementation.
  39  * It is designed to be used unchanged by at least core reflection and JDI.
  40  */
  41 public class ClassRepository extends GenericDeclRepository<ClassSignature> {
  42 


  43     private Type superclass; // caches the generic superclass info
  44     private Type[] superInterfaces; // caches the generic superinterface info
  45 
  46  // private, to enforce use of static factory
  47     private ClassRepository(String rawSig, GenericsFactory f) {
  48         super(rawSig, f);
  49     }
  50 
  51     protected ClassSignature parse(String s) {
  52         return SignatureParser.make().parseClassSig(s);
  53     }
  54 
  55     /**
  56      * Static factory method.
  57      * @param rawSig - the generic signature of the reflective object
  58      * that this repository is servicing
  59      * @param f - a factory that will provide instances of reflective
  60      * objects when this repository converts its AST
  61      * @return a <tt>ClassRepository</tt> that manages the generic type
  62      * information represented in the signature <tt>rawSig</tt>




  23  * questions.
  24  */
  25 
  26 package sun.reflect.generics.repository;
  27 
  28 import sun.reflect.generics.factory.GenericsFactory;
  29 import sun.reflect.generics.tree.ClassSignature;
  30 import sun.reflect.generics.tree.TypeTree;
  31 import sun.reflect.generics.visitor.Reifier;
  32 import sun.reflect.generics.parser.SignatureParser;
  33 import java.lang.reflect.Type;
  34 
  35 
  36 /**
  37  * This class represents the generic type information for a class.
  38  * The code is not dependent on a particular reflective implementation.
  39  * It is designed to be used unchanged by at least core reflection and JDI.
  40  */
  41 public class ClassRepository extends GenericDeclRepository<ClassSignature> {
  42 
  43     public static final ClassRepository NONE = ClassRepository.make("Ljava/lang/Object;", null);
  44 
  45     private Type superclass; // caches the generic superclass info
  46     private Type[] superInterfaces; // caches the generic superinterface info
  47 
  48  // private, to enforce use of static factory
  49     private ClassRepository(String rawSig, GenericsFactory f) {
  50         super(rawSig, f);
  51     }
  52 
  53     protected ClassSignature parse(String s) {
  54         return SignatureParser.make().parseClassSig(s);
  55     }
  56 
  57     /**
  58      * Static factory method.
  59      * @param rawSig - the generic signature of the reflective object
  60      * that this repository is servicing
  61      * @param f - a factory that will provide instances of reflective
  62      * objects when this repository converts its AST
  63      * @return a <tt>ClassRepository</tt> that manages the generic type
  64      * information represented in the signature <tt>rawSig</tt>