31 32 33 /** 34 * Abstract superclass for representing the generic type information for 35 * a reflective entity. 36 * The code is not dependent on a particular reflective implementation. 37 * It is designed to be used unchanged by at least core reflection and JDI. 38 */ 39 public abstract class AbstractRepository<T extends Tree> { 40 41 // A factory used to produce reflective objects. Provided when the 42 //repository is created. Will vary across implementations. 43 private final GenericsFactory factory; 44 45 private final T tree; // the AST for the generic type info 46 47 //accessors 48 private GenericsFactory getFactory() { return factory;} 49 50 /** 51 * Accessor for <tt>tree</tt>. 52 * @return the cached AST this repository holds 53 */ 54 protected T getTree(){ return tree;} 55 56 /** 57 * Returns a <tt>Reifier</tt> used to convert parts of the 58 * AST into reflective objects. 59 * @return a <tt>Reifier</tt> used to convert parts of the 60 * AST into reflective objects 61 */ 62 protected Reifier getReifier(){return Reifier.make(getFactory());} 63 64 /** 65 * Constructor. Should only be used by subclasses. Concrete subclasses 66 * should make their constructors private and provide public factory 67 * methods. 68 * @param rawSig - the generic signature of the reflective object 69 * that this repository is servicing 70 * @param f - a factory that will provide instances of reflective 71 * objects when this repository converts its AST 72 */ 73 protected AbstractRepository(String rawSig, GenericsFactory f) { 74 tree = parse(rawSig); 75 factory = f; 76 } 77 78 /** 79 * Returns the AST for the generic type info of this entity. | 31 32 33 /** 34 * Abstract superclass for representing the generic type information for 35 * a reflective entity. 36 * The code is not dependent on a particular reflective implementation. 37 * It is designed to be used unchanged by at least core reflection and JDI. 38 */ 39 public abstract class AbstractRepository<T extends Tree> { 40 41 // A factory used to produce reflective objects. Provided when the 42 //repository is created. Will vary across implementations. 43 private final GenericsFactory factory; 44 45 private final T tree; // the AST for the generic type info 46 47 //accessors 48 private GenericsFactory getFactory() { return factory;} 49 50 /** 51 * Accessor for {@code tree}. 52 * @return the cached AST this repository holds 53 */ 54 protected T getTree(){ return tree;} 55 56 /** 57 * Returns a {@code Reifier} used to convert parts of the 58 * AST into reflective objects. 59 * @return a {@code Reifier} used to convert parts of the 60 * AST into reflective objects 61 */ 62 protected Reifier getReifier(){return Reifier.make(getFactory());} 63 64 /** 65 * Constructor. Should only be used by subclasses. Concrete subclasses 66 * should make their constructors private and provide public factory 67 * methods. 68 * @param rawSig - the generic signature of the reflective object 69 * that this repository is servicing 70 * @param f - a factory that will provide instances of reflective 71 * objects when this repository converts its AST 72 */ 73 protected AbstractRepository(String rawSig, GenericsFactory f) { 74 tree = parse(rawSig); 75 factory = f; 76 } 77 78 /** 79 * Returns the AST for the generic type info of this entity. |