forked from highsource/jaxb-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[highsource#453] : fix simplify plugin to respect globalBindings isSe…
…t / indexed properties
- Loading branch information
1 parent
6e87985
commit 03c7915
Showing
25 changed files
with
556 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
jaxb-plugins-parent/tests/simplify-01/src/main/resources/binding.xjb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.jvnet.jaxb</groupId> | ||
<artifactId>jaxb-plugins-tests</artifactId> | ||
<version>4.0.1-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>jaxb-plugins-test-simplify-03</artifactId> | ||
<packaging>jar</packaging> | ||
<name>JAXB Tools :: JAXB Plugins :: Test [simplify-03]</name> | ||
<description>Test for issue #453 (related to issue in jaxb2-basics #115)</description> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.jvnet.jaxb</groupId> | ||
<artifactId>jaxb-maven-plugin-testing</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jvnet.jaxb</groupId> | ||
<artifactId>jaxb-plugins</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>joda-time</groupId> | ||
<artifactId>joda-time</artifactId> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<defaultGoal>test</defaultGoal> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.jvnet.jaxb</groupId> | ||
<artifactId>jaxb-maven-plugin</artifactId> | ||
<configuration> | ||
<extension>true</extension> | ||
<args> | ||
<arg>-Xsimplify</arg> | ||
<arg>-Xsimplify-usePluralForm=true</arg> | ||
</args> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.jvnet.jaxb</groupId> | ||
<artifactId>jaxb-plugins</artifactId> | ||
</plugin> | ||
</plugins> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
21 changes: 21 additions & 0 deletions
21
...ests/simplify-03/src/main/java/org/jvnet/jaxb/plugin/simplify/tests03/BaseElementRef.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.jvnet.jaxb.plugin.simplify.tests03; | ||
|
||
import jakarta.xml.bind.JAXBElement; | ||
import javax.xml.namespace.QName; | ||
|
||
@SuppressWarnings("serial") | ||
public class BaseElementRef extends JAXBElement<BaseType> { | ||
|
||
protected final static QName NAME = new QName("urn:test", "baseElement"); | ||
|
||
@SuppressWarnings({ "unchecked", "rawtypes" }) | ||
public BaseElementRef(BaseType value) { | ||
super(NAME, ((Class) BaseType.class), null, value); | ||
} | ||
|
||
@SuppressWarnings({ "unchecked", "rawtypes" }) | ||
public BaseElementRef() { | ||
super(NAME, ((Class) BaseType.class), null, null); | ||
} | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
...t/tests/simplify-03/src/main/java/org/jvnet/jaxb/plugin/simplify/tests03/DateAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.jvnet.jaxb.plugin.simplify.tests03; | ||
|
||
import java.util.Date; | ||
|
||
import jakarta.xml.bind.annotation.adapters.XmlAdapter; | ||
|
||
import org.joda.time.DateTime; | ||
import org.joda.time.format.DateTimeFormatter; | ||
import org.joda.time.format.ISODateTimeFormat; | ||
|
||
/** | ||
* | ||
* | ||
* @author | ||
*/ | ||
public class DateAdapter extends XmlAdapter<String, Date> { | ||
|
||
private static final DateTimeFormatter PARSER = ISODateTimeFormat | ||
.dateTimeParser().withZoneUTC(); | ||
private static final DateTimeFormatter FORMATTER = ISODateTimeFormat | ||
.dateTime().withZoneUTC(); | ||
|
||
@Override | ||
public String marshal(Date value) throws Exception { | ||
return new DateTime(value).toString(FORMATTER); | ||
} | ||
|
||
@Override | ||
public Date unmarshal(String text) throws Exception { | ||
return PARSER.parseDateTime(text).toDate(); | ||
} | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
jaxb-plugins-parent/tests/simplify-03/src/main/resources/binding.xjb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<jaxb:bindings xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb" | ||
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:simplify="urn:jaxb.jvnet.org:plugin:simplify" | ||
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" | ||
jaxb:extensionBindingPrefixes="xjc simplify" jaxb:version="3.0"> | ||
|
||
<jaxb:globalBindings choiceContentProperty="true" collectionType="indexed"> | ||
<xjc:javaType name="java.util.Date" xmlType="xs:dateTime" | ||
adapter="org.jvnet.jaxb.plugin.simplify.tests03.DateAdapter" /> | ||
</jaxb:globalBindings> | ||
|
||
<jaxb:bindings schemaLocation="schema.xsd" node="/xs:schema"> | ||
<jaxb:schemaBindings> | ||
<jaxb:package name="org.jvnet.jaxb.plugin.simplify.tests03" /> | ||
</jaxb:schemaBindings> | ||
<jaxb:bindings node="xs:complexType[@name='gh2']"> | ||
<simplify:property name="bOrC"> | ||
<simplify:as-element-property /> | ||
</simplify:property> | ||
</jaxb:bindings> | ||
<jaxb:bindings node="xs:complexType[@name='gh18']"> | ||
<simplify:property name="childOrFootOrFoo"> | ||
<simplify:as-element-property /> | ||
</simplify:property> | ||
</jaxb:bindings> | ||
</jaxb:bindings> | ||
</jaxb:bindings> | ||
|
Oops, something went wrong.