javaee / jaxb2-commons

JAXB Implementation project has been contributed to Eclipse Foundation. This repository is for legacy review only. Please refer to the Eclipse EE4J Metro project for the very latest
https://eclipse-ee4j.github.io/jaxb-ri/
Other
17 stars 15 forks source link

generateIsSetMethod attribute causes Setter-Collection XJC plugin to not generate Setter methods on collection #30

Closed glassfishrobot closed 12 years ago

glassfishrobot commented 17 years ago

If generateIsSetMethod attribute is set to True in globalBindings And the Collection-Setter-injector plugin is also being used in the XJCTask then the generated code does not contain the set<>() method.

Basically enabling the generateIsSetMethod attribute renders the Collector- Setter plugin ineffective.

The cause is that generateIsMethod causes all the declaredFields to be of instance of IsSetField. Whereas with generateIsMethod set to false (default) result in the ClassOutline.getDeclaredFields() to be of type UntypedListField for all schema elements which have maxOccurs unbounded.

Environment

Operating System: All Platform: All

glassfishrobot commented 17 years ago

Reported by sameer_v_rao

glassfishrobot commented 17 years ago

rebeccas said: Please provide a test case to show the issue.

glassfishrobot commented 17 years ago

sameer_v_rao said: Steps to recreate the problem. 1. Create a schema file having an element which has maxOccurs="unbounded"

<complexType name="BType>

<complexType name="CType>

<complexType name="DType>

<complexType name="EType>


2. Download and use Xcollection-setter-injector plugin. 3. Also create a JAXB Custom binding file and set the following globalBinding options- generateElementProperty="false" generateIsSetMethod="true"

4. Create a ANT build script which defines the XJCTask. Also use the Xcollection-setter-injector plugin (by passing the args to the XJC).

5. Run the build script to generate the code. 6. The AType.java class should now have the IsSet method for all the 4 elements aType, bType, cType and dType. But it shoud also have setBType(List

() method and also setDType (List ) {} method. which are missing. I think i know the problem/resolution- The Collection-Setter-Injector plugin is using a check on whether the item in the codemodel is of type "UntypedList" which it should not be using. Instead it should check for isCollection() on the JProperty for that element and then proceed to build the setxxx() method.
glassfishrobot commented 17 years ago

kohsuke said: Please contact the plugin author. Sounds like you are really reporting an issue against a plugin not against XJC.

glassfishrobot commented 17 years ago

kohsuke said: Marking for exclusion from Glassfish v2.

glassfishrobot commented 17 years ago

kohsuke said: Still trying to exclude from GFv2.

glassfishrobot commented 16 years ago

snajper said: as911na

glassfishrobot commented 15 years ago

@pavelbucek said: adjusting priority

glassfishrobot commented 12 years ago

lexi said: Please use the Setters plugin from JAXB2-Basics:

This issue will be closed with "Won't Fix".

glassfishrobot commented 7 years ago

This issue was imported from java.net JIRA JAXB2_COMMONS-30

glassfishrobot commented 12 years ago

Marked as won't fix on Saturday, September 24th 2011, 5:54:32 am