Details
-
Type: New Feature
-
Status: Closed
-
Priority: Minor
-
Resolution: Won't Fix
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
Rather than globally mapping a class to an alias, it would be nice to make a mapping contextual; that is, to make a mapping conditional upon parent nodes.
For example, if my class has a list of, say, usernames, the generated (and expected) XML for it might look like:
...
<users>
<string>Tom</string>
<string>Dick</string>
<string>Harry</string>
</users>
...
In this case, it would be nice to alias java.lang.String as "user" when contained by "users", resulting in:
...
<users>
<user>Tom</user>
...
Globally aliasing java.lang.String has some obvious drawbacks.
I looked through the code and it looks like this would be a rather large undertaking, but thought I'd toss the idea out.
Issue Links
- is related to
-
XSTR-124 Advanced Aliases
This is already quite easily possible, by registering an own converter instance for the collection and an own instance of the ClassAliasingMapper:
The converter might have been registered locally instead to avoid a global redefinition for all collection types.