i've taken a look into this (and even added another test case to convince myself that i'm right). the BeanDescriptor name is passed to the name mapper to create the element. i'm pretty sure that this should be the class name without the package. (it is on my machine at least).
it is possible that this is an issue with the alpha1 release that has resolved itself since then.
- robert
On Wednesday, August 13, 2003, at 07:53 PM, Daniel Rall wrote:
Daniel Rall <[EMAIL PROTECTED]> writes: ...is it possible to use HyphenatedNameMapper's mapTypeToElementName(String typeName) (or something of the sort) to transform ScarabIssues.class into the String "scarab-issues" (to obviate the hard-coding of magic strings)?
To answer my own quesiton, it is possible:
http://scarab.tigris.org/source/browse/scarab/src/java/org/tigris/scarab/ util/xmlissues/ImportIssues.java.diff?r1=1.25&r2=1.26
You'll notice that I had to add a local mapTypeToElementName(Class, NameMapper) method which strips the package name off of the class name before handing off to HyphenatedNameMapper for resolution to a XML element. This same code must be present somewhere within Betwixt, and I would prefer to take advantage of it rather than re-implementing it in Scarab's ImportIssues class. It may be only a few trivial lines, but I feel that my inclusion of it infringes on ideal encapsulation (even with my update of Betwixt's JavaDoc). A possible improvement would be to loosen the API of NameMapper to accept Object rather than String, then use "instanceof Class" inside of HyphenatedNameMapper to detemine whether a package name should be stripped off of the input. This would shift all mapping responsibility out of elsewhere in Betwixt (called from somewhere in BeanReader, I assume) down into NameMapper implementations. Perhaps not what is wanted, of course -- just a suggestion.
- Dan
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
