https://issues.apache.org/bugzilla/show_bug.cgi?id=50703
--- Comment #2 from Andreas L. Delmelle <[email protected]> 2011-02-02 15:58:50 EST --- > Not sure that's what you're looking for but you can add this to PropertyCache: > > public static <T> PropertyCache<T> createFor(Class<T> c) { > return new PropertyCache<T>(c); > } Good suggestion. That would at least slightly shorten the creation statements in the various property classes. Comes very close, but what I was actually looking for was a way to leave out the constructor parameter completely, and in the constructor, infer the Class from the type parameter T, so something in the direction of this.runtimeType = T.class; Quite impossible, obviously, given the implementation of generics. In the end, T only exists for the compiler... The idiom would then just be very standard: PropertyCache<FontFamilyProperty> CACHE = new PropertyCache<FontFamilyProperty>(); (and as of Java 7, IIC, even more concise: PropertyCache<FontFamilyProperty> CACHE = new PropertyCache<>(); ) The more I think about it, the more I am tempted to go for just dropping the parameter, or maybe providing it only as an alternate constructor. Ultimately, it's only use is for debugging. I had added this, but must admit, I have never really used it... -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.
