Comments (6)
You're right, property name creation is hardcoded at the moment:
from jaxb2-basics.
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.
@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.
See also http://jira.highsource.org/browse/JIIB-54.
from jaxb2-basics.
@highsource there are news about property name customization?
from jaxb2-basics.
No, not yet. PRs welcome - as always.
from jaxb2-basics.
Related Issues (20)
- Update build to use maven release plugin
- Reverting jakarta initial changes HOT 1
- Update to latests jaxb v2.x
- Update to JUnit 4.13.2
- Upgrade to commons-io 2.11.0
- Update to JDK 1.8 minimum for source and target
- Add support for building with JDK 9+
- Update maven scm for release automation
- Bump version to 0.13.0-SNAPSHOT
- Fix maven-deploy-plugin / oss-staging-plugin fighting each other
- Update version to 2.3.6-SNAPSHOT
- Migrate to jakarta.oss.sonatype.org HOT 1
- Take over the remaining jaxb2_commons plugins HOT 11
- Bump commons-beanutils HOT 10
- Jakarta classes support for jaxb2-basics HOT 20
- Simplifying element (rather than type) results in 'Unable to honor this as-element-property customization. It is attached to a wrong place, or its inconsistent with other bindings.'. HOT 1
- Possibilty to find a fix for fixedValues in ComplexType restriction
- Prepare migration to jakarta HOT 1
- Is the latest release published on Maven Repository? HOT 6
- Other xjc plugins repository - maybe useful source code
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jaxb2-basics.