< prev index next >

src/java.base/share/classes/sun/reflect/generics/repository/ConstructorRepository.java

Print this page




  47     private volatile Type[] parameterTypes;
  48 
  49     /** The generic exception types.  Lazily initialized. */
  50     private volatile Type[] exceptionTypes;
  51 
  52  // protected, to enforce use of static factory yet allow subclassing
  53     protected ConstructorRepository(String rawSig, GenericsFactory f) {
  54       super(rawSig, f);
  55     }
  56 
  57     protected MethodTypeSignature parse(String s) {
  58         return SignatureParser.make().parseMethodSig(s);
  59     }
  60 
  61     /**
  62      * Static factory method.
  63      * @param rawSig - the generic signature of the reflective object
  64      * that this repository is servicing
  65      * @param f - a factory that will provide instances of reflective
  66      * objects when this repository converts its AST
  67      * @return a <tt>ConstructorRepository</tt> that manages the generic type
  68      * information represented in the signature <tt>rawSig</tt>
  69      */
  70     public static ConstructorRepository make(String rawSig, GenericsFactory f) {
  71         return new ConstructorRepository(rawSig, f);
  72     }
  73 
  74  /*
  75  * When queried for a particular piece of type information, the
  76  * general pattern is to consult the corresponding cached value.
  77  * If the corresponding field is non-null, it is returned.
  78  * If not, it is created lazily. This is done by selecting the appropriate
  79  * part of the tree and transforming it into a reflective object
  80  * using a visitor, which is created by feeding it the factory
  81  * with which the repository was created.
  82  */
  83 
  84     public Type[] getParameterTypes() {
  85         Type[] value = parameterTypes;
  86         if (value == null) {
  87             value = computeParameterTypes();
  88             parameterTypes = value;




  47     private volatile Type[] parameterTypes;
  48 
  49     /** The generic exception types.  Lazily initialized. */
  50     private volatile Type[] exceptionTypes;
  51 
  52  // protected, to enforce use of static factory yet allow subclassing
  53     protected ConstructorRepository(String rawSig, GenericsFactory f) {
  54       super(rawSig, f);
  55     }
  56 
  57     protected MethodTypeSignature parse(String s) {
  58         return SignatureParser.make().parseMethodSig(s);
  59     }
  60 
  61     /**
  62      * Static factory method.
  63      * @param rawSig - the generic signature of the reflective object
  64      * that this repository is servicing
  65      * @param f - a factory that will provide instances of reflective
  66      * objects when this repository converts its AST
  67      * @return a {@code ConstructorRepository} that manages the generic type
  68      * information represented in the signature {@code rawSig}
  69      */
  70     public static ConstructorRepository make(String rawSig, GenericsFactory f) {
  71         return new ConstructorRepository(rawSig, f);
  72     }
  73 
  74  /*
  75  * When queried for a particular piece of type information, the
  76  * general pattern is to consult the corresponding cached value.
  77  * If the corresponding field is non-null, it is returned.
  78  * If not, it is created lazily. This is done by selecting the appropriate
  79  * part of the tree and transforming it into a reflective object
  80  * using a visitor, which is created by feeding it the factory
  81  * with which the repository was created.
  82  */
  83 
  84     public Type[] getParameterTypes() {
  85         Type[] value = parameterTypes;
  86         if (value == null) {
  87             value = computeParameterTypes();
  88             parameterTypes = value;


< prev index next >