|
From: | Wolfgang Baer |
Subject: | Re: [cp-patches] [FYI]: Patch for javax.print.attribute.standard package |
Date: | Fri, 13 Jan 2006 23:44:42 +0100 |
User-agent: | Debian Thunderbird 1.0.7 (X11/20051017) |
Hi Mark, sorry for the late response. Mark Wielaard wrote:
Hi Wolfgang, On Fri, 2005-12-30 at 14:07 +0100, Wolfgang Baer wrote:2005-12-30 Wolfgang Baer <address@hidden> * javax/print/attribute/standard/package.html: Added description. * javax/print/attribute/standard/MediaSize.java: Added and updated javadocs to class and methods. (static_initializer): Initialize nested class constants. (MediaSize): Add instances to the cache. (MediaSize): Likewise. (MediaSize): Likewise. (MediaSize): Likewise. [...] + private static ArrayList mediaCache;+ + static+ { + mediaCache = new ArrayList(); + + MediaSize tmp = MediaSize.ISO.A0; + tmp = MediaSize.JIS.B0; + tmp = MediaSize.Engineering.A; + tmp = MediaSize.NA.LEGAL; + tmp = MediaSize.Other.EXECUTIVE; + }It took me a while to realize what was going on here. I think a comment is in place (and how do you guarantee that all the other inner classes are registered? Like MediaSize.ISO.A4 for example.).
All the static instances in the inner container classes like ISO or OTHER should be automatically added as they are static. Or do I miss something ? At least every instance is added as far as I can see. Evrything I do here is to call one instance of every container class so it gets loaded and everyone of its static MediaSize objects are instantiated. Should I put a comment here ?
Are you sure that every newly created MediaSize object should automagically be added to the mediaCache and not just the standard MediaSizes? I see there is no other method to register a new "standard" MediaSize, but adding it through the public constructor seems asking for confusion.
The just commited mauve test "userClass" shows that user constructed MediaSize subclass instances are added to the cache used by findMedia and the other static methods. So I am think I am right here. Regards, Wolfgang
[Prev in Thread] | Current Thread | [Next in Thread] |