Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 333601

Summary: Enhancement: Customizable Name Mangling Algorithm
Product: z_Archived Reporter: Blaise Doughan <blaise.doughan>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: denise.mahar
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 332770, 348117    
Attachments:
Description Flags
Proposed code changes
none
Proposed test changes
none
Proposed code changes -updated
none
Proposed test changes -updated
none
Proposed changes
none
Proposed test changes none

Description Blaise Doughan CLA 2011-01-05 15:12:35 EST
A mechanism should be provided to allow the customization of the name mangling algorithm used by JAXB.  

This could be implemented as an annotation like the following (with an equivalent XML representation) that could be specified at the package/type/field/property level.  This annotation would take an impl class that provides the name mangling algorithm.

    @XmlNameMangler(UpperCaseNameMangler.class)

The impl class would need to implement an interface like the following:

    public interface NameMangler {
        mangeName(String namespaceURI, String name);

    }

MOXy could provide several implementations of this interface:

   1.  default - the standard algorithm
   2.  upper case - everything is upper case
   3.  lower case - everything is lower case
Comment 1 Blaise Doughan CLA 2011-01-05 15:15:36 EST
Some consideration should be given as to whether this can be made consistent with the schema annotation "nameXmlTransform" as described in section 7.6.1 of the JAXB 2.1 specification.
Comment 2 Blaise Doughan CLA 2011-01-07 16:06:46 EST
Correction:

The NameMangler interface should look something like:

    /**
     * Return the XML local name based on the Java attribute name
     */
    public interface NameMangler {
        String mangleName(String name);

    }
Comment 3 Denise Smith CLA 2011-04-11 16:24:16 EDT
Created attachment 192976 [details]
Proposed code changes
Comment 4 Denise Smith CLA 2011-04-11 16:25:17 EDT
Created attachment 192977 [details]
Proposed test changes
Comment 5 Denise Smith CLA 2011-04-12 15:57:13 EDT
Created attachment 193088 [details]
Proposed code changes -updated
Comment 6 Denise Smith CLA 2011-04-12 15:57:34 EDT
Created attachment 193089 [details]
Proposed test changes -updated
Comment 7 Denise Smith CLA 2011-04-20 13:35:33 EDT
Created attachment 193726 [details]
Proposed changes
Comment 8 Denise Smith CLA 2011-04-20 13:36:06 EDT
Created attachment 193727 [details]
Proposed test changes
Comment 9 Denise Smith CLA 2011-05-02 13:27:31 EDT
Fixed with patches attached.
Comment 10 Eclipse Webmaster CLA 2022-06-09 10:19:47 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink