Kenny MacLeod wrote:
> The plugin is given the fields as a map of field names to field
> definitions, so it appears that the original attribute ordering is lost.
>
> I may be wrong, but the plugin framework doesn't given the plugins
> access to the original schema. Instead, it gives them access to the
> generated code model, which the plugin can then modify.
It kind of do. You can go CPropertyInfo.getSchemaComponent() to get to
the schema components. With a recent fix to XSOM, this now actually
preserves attributes in declaration order (usually, not always.)
Let me make sure that I integrated the latest XSOM in the RI.
> If someone could point me to a way for the plugin to obtain information
> on the ordering, I'd be happy to try and modify the plugin to
> incorporate it.
>
>
> Lowell Kirsh wrote:
> > I am using the value-constructor plugin
> > (https://jaxb2-commons.dev.java.net/value-constructor/) to generate
> > constructors. The order of the params is not what I have specified in my
> > xsd. In my xsd I have:
> >
> > <xs:element name="localization">
> > <xs:complexType>
> > <xs:attribute name="locale"/>
> > <xs:attribute name="label"/>
> > ...
> >
> > And when I use the value-constructor plugin, it gives me the following
> > constructor
> >
> > public Localization(String label, String locale) { ...}
> >
> > I'm not sure how the plugin determines the order of arguments. Looking
> > at the java file that Jaxb creates without the plugin, label appears
> > before locale (not that this neccessarily means anything).
> >
> > Basically what I want to accomplish is to control the order of the
> > constructor arguments. But since these are xml attributes, their order
> > in an xml file does not matter, so perhaps it's outside of the jaxb spec
> > to have any control over their ordering in the generated java code.
> >
> > My questions are: does the value-constructor plugin control this order,
> > or does it get it from the jaxb impl? And if it gets it from the jaxb
> > impl, can the jaxb impl control the order?
> >
> > Thanks
> > Lowell
> >
>
>
> Lowell Kirsh wrote:
>> I am using the value-constructor plugin
>> (https://jaxb2-commons.dev.java.net/value-constructor/) to generate
>> constructors. The order of the params is not what I have specified in my
>> xsd. In my xsd I have:
>>
>> <xs:element name="localization">
>> <xs:complexType>
>> <xs:attribute name="locale"/>
>> <xs:attribute name="label"/>
>> ...
>>
>> And when I use the value-constructor plugin, it gives me the following
>> constructor
>>
>> public Localization(String label, String locale) { ...}
>>
>> I'm not sure how the plugin determines the order of arguments. Looking
>> at the java file that Jaxb creates without the plugin, label appears
>> before locale (not that this neccessarily means anything).
>>
>> Basically what I want to accomplish is to control the order of the
>> constructor arguments. But since these are xml attributes, their order
>> in an xml file does not matter, so perhaps it's outside of the jaxb spec
>> to have any control over their ordering in the generated java code.
>>
>> My questions are: does the value-constructor plugin control this order,
>> or does it get it from the jaxb impl? And if it gets it from the jaxb
>> impl, can the jaxb impl control the order?
>>
>> Thanks
>> Lowell
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>
--
Kohsuke Kawaguchi
Sun Microsystems kohsuke.kawaguchi_at_sun.com