users@jaxb.java.net

Re: XJC plugin

From: Chris Frohoff <frohoff_at_yahoo.com>
Date: Mon, 8 Sep 2008 22:27:22 -0700 (PDT)

Incidentally, though this particular plugin is really only for
code-generation-manipulation and has nothing directly to do with bean
mapping, one of my primary motivations for writing it was to better leverage
convention-based default mapping of my JAXB and Entity bean classes with
Dozer.


Felipe Gaucho wrote:
>
> very nice, did you checked the Dozer framework.. they do the same, but
> using apache commons as base.. (instead of jaxb)....
>
> I blogged few dayz ago about that>
> http://weblogs.java.net/blog/felipegaucho/archive/2008/09/question_how_to_1.html
>
> are you planning to use reflection to match attributes with same name
> and type ? it could reduce the size of the external configuration - a
> kind of default behavior....
>
> On Sun, Sep 7, 2008 at 8:09 AM, Chris Frohoff <frohoff_at_yahoo.com> wrote:
>>
>> I've written an XJC plugin for altering generated classes including:
>> property
>> pluralization (similar to but not requiring
>> simple-and-better-binding-mode),
>> renaming classes/properties, and adding interfaces and/or arbitrary code
>> to
>> classes, all based on exact or regex name matching.
>>
>> I'd like to gauge interest, obtain feedback, and find out about
>> contributing
>> it to the jaxb2-commons project.
>>
>> A sample external binding configuration is below:
>>
>> <bindings
>> xmlns="http://java.sun.com/xml/ns/jaxb"
>> xmlns:xs="http://www.w3.org/2001/XMLSchema" version="2.1"
>> extensionBindingPrefixes="b"
>> xmlns:b="http://frohoff.org/ns/xjc/beans">
>>
>> <bindings schemaLocation="test.xsd" node="/xs:schema">
>> <globalBindings choiceContentProperty="true">
>> </globalBindings>
>> <schemaBindings>
>> <package name="org.frohoff.jaxb.test"></package>
>> </schemaBindings>
>> <b:class name-match="(\w+)RefType">
>> <b:implement class="org.frohoff.jaxb.test.Ref" />
>> </b:class>
>> <b:class name-match="(\w+)DefType">
>> <b:implement class="org.frohoff.jaxb.test.Def" />
>> </b:class>
>> <b:class>
>> <b:property name-match="(\w+)Or\1Ref">
>> <b:rename replacement="$1" />
>> <b:pluralize/>
>> </b:property>
>> <b:code>
>> public void test() {
>> System.out.println("this is a test");
>> }
>> </b:code>
>> </b:class>
>> </bindings>
>> </bindings>
>>
>> -Chris Frohoff
>>
>> --
>> View this message in context:
>> http://www.nabble.com/XJC-plugin-tp19354645p19354645.html
>> Sent from the java.net - jaxb users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>
>

-- 
View this message in context: http://www.nabble.com/XJC-plugin-tp19354645p19386082.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.