Thanks Thomas. I'd like to do this because for mvp4g, I'd like developers to be able to set a gin module thanks to deferred property (http:// groups.google.com/group/mvp4g/browse_thread/thread/87a1cc4a8a683381) so that a different gin module can be used for different type of platform. But, because this property can be different for each permutation, I need to generate one version for each permutation, ie the tryCreate method of GeneratorContext should never return null. In order to do this (if I understand it correctly), I need a unique implementation class name.
Developer could define zero to many properties so using their values would be difficult. I was thinking using a simple static counter (and synchronize the increment method to prevent multi-thread issue). On Jul 6, 9:51 am, Thomas Broyer <[email protected]> wrote: > In most cases, if you generate different things for different permutations, > you know the deferred binding property you depend on, so you can use them to > build the class name. If you want, you can still use all of the binding > properties and their value(s), using a CRC32 or similar (Alder32 is faster, > it's what ClientBundle uses for CssResources obfuscated names) to make it > smaller but still unique. > I believe you could also use a static map as a cache of what you already > generated, using the SelectionProperties as the key and a generated unique > String as the value; each time the generator is called, look up in the map, > and you find nothing, generate a new class name and push it in, then > generate the class. > > The question actually is *why* would you want to do this? > > (btw, another example where it's very easy to defeat user.agent as a key: > using several locales) -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
