SourceForge.net Logo
Main Overview Wiki Issues Forum Build Fisheye
Issue Details (XML | Word | Printable)

Key: CMP-651
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Shay Banon
Reporter: Kenny MacLeod
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Compass

Enhance lookupConverter(String) in ConverterLookup interface to lookup based on classname

Created: 11/Jun/08 01:31 AM   Updated: 12/Jun/08 02:34 PM
Component/s: Compass::Core
Affects Version/s: 2.0.0 GA
Fix Version/s: 2.0.1, 2.1.0 M1


 Description  « Hide
I'm trying to write a JAXB2 XJC plugin which adds Compass annotations to JAXB-generated classes, and I need to be able to determine if a given Compass configuration has a type converter for a given class.

Because XJC plugins operate off a code metamodel, I don't have instances of Class objects to pass to ConverterLookup.lookupConverter(), I only have the class name. If ConverterLookup had a lookupConverterByClassName(), this would asolve my problem nicely. As it is, I have to use reflection to get hold of the maps inside DefaultConverterLookup, and introspect that.

If you don't want to add the method to the ConverterLookup interface itself, then even just adding it to DefaultConverterLookup as a public method would probably suffice.



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Shay Banon added a comment - 12/Jun/08 08:53 AM
Can't you create the class based on the String and then pass it? This is what I would need to do in the purposed new method anyhow...

Kenny MacLeod added a comment - 12/Jun/08 08:57 AM
Not really. Te code metamodel being manipulated involves the creation of java source files, and therefore the class files are not there to be loaded.

Given that DefaultConverterLookup currently just calls class.getName() and consults its internal data strcutures using that name, the Class object itself isn't actually necessary.


Shay Banon added a comment - 12/Jun/08 02:34 PM
Make sense. I simply enhanced lookupConverter to support searching either by name or FQN of the class. Fixed for 2.0.1 and 2.1 M1.