Giter Site home page Giter Site logo

Comments (6)

highsource avatar highsource commented on August 12, 2024

You're right, property name creation is hardcoded at the moment:

https://github.com/highsource/jaxb2-basics/blob/master/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java#L350-L369

from jaxb2-basics.

mkotelba avatar mkotelba commented on August 12, 2024

After taking a stab at it, I must admit that the guts of XJC are tricky as hell; I have a new-found appreciation for the Simplify plugin :)

I tried to approach the functionality by adding a new Simplify-specific customization element, generated-property, that can be used multiple times in the same context as the relevant Simplify as-*-property, each time providing an association of a property local name that naturally gets spit out by Simplify -> what you actually want it to be called.

Once you get down to the correct CPropertyInfo, its easy (2x calls to setName for the public/private variants). Dealing with the crazy complexity of all possible combinations to get there (CReferencePropertyInfo, CElementPropertyInfo, etc combos) + possible Java keyword conflicts that result in forced renames and even more abstraction = I gave up and wrote a terrible Groovy GMaven build script that just iterates through the ClassOutlines' properties.

from jaxb2-basics.

highsource avatar highsource commented on August 12, 2024

@mkotelba Sorry to hear about this. I actually did not thought it was so complex. I'd personally add a configuration sub-element like

<simplify:as-element-property>
<simplify:property element="foo:bar" name="bar"/>
</simplify:as-element-property>

The XML element names should be quite easy to get from items of CElementPropertyInfo or CReferencePropertyInfo. So find out the QName of the element and look up the customized property name for it in the customization.

  • For the element property info it is here (CTypeRef.getTagName() provides the QName).
  • For the element reference property info it is here (CElement.getElementName() provides the QName).

So I think this must be doable.

What were you trying to do, exactly? Would you give an example of your desired customization?

from jaxb2-basics.

highsource avatar highsource commented on August 12, 2024

See also http://jira.highsource.org/browse/JIIB-54.

from jaxb2-basics.

Cavva79 avatar Cavva79 commented on August 12, 2024

@highsource there are news about property name customization?

from jaxb2-basics.

highsource avatar highsource commented on August 12, 2024

No, not yet. PRs welcome - as always.

from jaxb2-basics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.