Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#389] javax to jakarta conversion #390

Merged
merged 1 commit into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/maven-build-action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
distribution: 'temurin'

- name: Maven with JDK 8
run: mvn -Pall -no-transfer-progress clean install
run: mvn -Pall -no-transfer-progress clean install

- name: Set up JDK 11
uses: actions/setup-java@v3
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Please refer to the [wiki](https://github.com/highsource/jaxb-tools/wiki/Annox-H
// Parse annotation from the string
XAnnotation<XmlRootElement> xannotation =
(XAnnotation<XmlRootElement>) XAnnotationParser.INSTANCE.parse
("@javax.xml.bind.annotation.XmlRootElement(name=\"foo\")");
("@jakarta.xml.bind.annotation.XmlRootElement(name=\"foo\")");

// Create an instance of the annotation
XmlRootElement xmlRootElement = xannotation.getResult();
Expand Down Expand Up @@ -188,8 +188,8 @@ You can put your annotations directly in schema:
````xml
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
jaxb:version="2.1"
xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb"
jaxb:version="3.0"
xmlns:annox="http://annox.dev.java.net"
jaxb:extensionBindingPrefixes="annox">

Expand Down Expand Up @@ -239,7 +239,7 @@ Or in binding files:
````xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jaxb:bindings
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:annox="http://annox.dev.java.net"
Expand All @@ -249,7 +249,7 @@ Or in binding files:

<jaxb:bindings schemaLocation="schema.xsd" node="/xs:schema">
<jaxb:bindings node="xs:complexType[@name='issueJIIB39CType']">
<annox:annotateClass>@javax.xml.bind.annotation.XmlRootElement(name="IssueJIIB39CType")</annox:annotateClass>
<annox:annotateClass>@jakarta.xml.bind.annotation.XmlRootElement(name="IssueJIIB39CType")</annox:annotateClass>
</jaxb:bindings>
<jaxb:bindings node="xs:complexType[@name='issueJIIB39CType']/xs:attribute[@name='test']">
<annox:annotate target="field">@javax.xml.bind.annotation.XmlAttribute(required=false, name="test")</annox:annotate>
Expand Down Expand Up @@ -299,23 +299,23 @@ You can remove annotations using customizations directly in schema:
````xml
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
jaxb:version="2.1"
xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb"
jaxb:version="3.0"
xmlns:annox="http://annox.dev.java.net"
jaxb:extensionBindingPrefixes="annox">

<xsd:complexType name="FooType">
<xsd:annotation>
<xsd:appinfo>
<annox:removeAnnotation class="javax.xml.bind.annotation.XmlType" />
<annox:removeAnnotation class="jakarta.xml.bind.annotation.XmlType" />
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="bar" type="xsd:string"/>
<xsd:element name="foobar" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<annox:removeAnnotation class="javax.xml.bind.annotation.XmlElement" target="field" />
<annox:removeAnnotation class="jakarta.xml.bind.annotation.XmlElement" target="field" />
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
Expand All @@ -330,7 +330,7 @@ Or in binding files:
````xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jaxb:bindings
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:annox="http://annox.dev.java.net"
Expand All @@ -340,10 +340,10 @@ Or in binding files:

<jaxb:bindings schemaLocation="schema.xsd" node="/xs:schema">
<jaxb:bindings node="xs:complexType[@name='FooType']">
<annox:removeAnnotation class="javax.xml.bind.annotation.XmlType" />
<annox:removeAnnotation class="jakarta.xml.bind.annotation.XmlType" />
</jaxb:bindings>
<jaxb:bindings node="xs:complexType[@name='FooType']//xs:element[@name='foobar']">
<annox:removeAnnotation class="javax.xml.bind.annotation.XmlElement" target="field" />
<annox:removeAnnotation class="jakarta.xml.bind.annotation.XmlElement" target="field" />
</jaxb:bindings>
</jaxb:bindings>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.Map;
import java.util.Map.Entry;

import javax.xml.bind.JAXBElement;
import jakarta.xml.bind.JAXBElement;

import org.apache.commons.lang3.Validate;
import org.jvnet.jaxb2_commons.codemodel.JCMType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import java.util.HashSet;
import java.util.Set;

import javax.xml.bind.JAXBElement;
import jakarta.xml.bind.JAXBElement;

import org.apache.commons.lang3.Validate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.util.HashSet;
import java.util.Set;

import javax.xml.bind.JAXBElement;
import jakarta.xml.bind.JAXBElement;

import org.jvnet.jaxb2_commons.codemodel.JConditionable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.jvnet.jaxb2_commons.plugin.inheritance;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import javax.xml.namespace.QName;

import org.jvnet.jaxb2_commons.util.CustomizationUtils;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package org.jvnet.jaxb2_commons.plugin.inheritance;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlValue;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlValue;
import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter;
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "extends")
@XmlAccessorType(XmlAccessType.PROPERTY)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package org.jvnet.jaxb2_commons.plugin.inheritance;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlValue;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlValue;
import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter;
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "implements")
@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.jvnet.jaxb2_commons.plugin.inheritance;

import javax.xml.bind.annotation.XmlRegistry;
import jakarta.xml.bind.annotation.XmlRegistry;

@XmlRegistry
public class ObjectFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlType;

@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "objectFactory")
@XmlType(propOrder = { "extendsClass", "implementsInterface" })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.jvnet.jaxb2_commons.plugin.namespace_prefix;

import javax.xml.bind.annotation.XmlNs;
import javax.xml.bind.annotation.XmlSchema;
import jakarta.xml.bind.annotation.XmlNs;
import jakarta.xml.bind.annotation.XmlSchema;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -34,27 +34,27 @@
import org.xml.sax.ErrorHandler;

/**
* This plugin adds {@link javax.xml.bind.annotation.XmlNs} annotations to <i>package-info.java</i> files. Those annotations tells Jaxb to generate XML schema's instances with specific namespaces
* This plugin adds {@link jakarta.xml.bind.annotation.XmlNs} annotations to <i>package-info.java</i> files. Those annotations tells JAXB to generate XML schema's instances with specific namespaces
* prefixes, instead of the auto-generated (ns1, ns2, ...) prefixes. Definition of thoses prefixes is done in the bindings.xml file.
*
* Bindings.xml file example:
* <pre>
* &lt;?xml version=&quot;1.0&quot;?&gt;
* &lt;jxb:bindings version=&quot;3.0&quot;
* xmlns:jxb=&quot;https://jakarta.ee/xml/ns/jaxb&quot;
* &lt;jaxb:bindings version=&quot;3.0&quot;
* xmlns:jaxb=&quot;https://jakarta.ee/xml/ns/jaxb&quot;
* xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
* xmlns:namespace=&quot;http://jaxb2-commons.dev.java.net/basic/namespace-prefix&quot;&gt;
*
* &lt;jxb:bindings schemaLocation=&quot;unireg-common-1.xsd&quot;&gt;
* &lt;jxb:schemaBindings&gt;
* &lt;jxb:package name=&quot;ch.vd.unireg.xml.common.v1&quot; /&gt;
* &lt;/jxb:schemaBindings&gt;
* &lt;jxb:bindings&gt;
* &lt;jaxb:bindings schemaLocation=&quot;unireg-common-1.xsd&quot;&gt;
* &lt;jaxb:schemaBindings&gt;
* &lt;jaxb:package name=&quot;ch.vd.unireg.xml.common.v1&quot; /&gt;
* &lt;/jaxb:schemaBindings&gt;
* &lt;jaxb:bindings&gt;
* <b>&lt;namespace:prefix name=&quot;common-1&quot; /&gt;</b>
* &lt;/jxb:bindings&gt;
* &lt;/jxb:bindings&gt;
* &lt;/jaxb:bindings&gt;
* &lt;/jaxb:bindings&gt;
*
* &lt;/jxb:bindings&gt;
* &lt;/jaxb:bindings&gt;
* </pre>
*
* @author Manuel Siggen (c) 2012 Etat-de-Vaud (www.vd.ch)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import com.sun.tools.xjc.model.CTypeRef;
import com.sun.tools.xjc.model.CValuePropertyInfo;
import com.sun.tools.xjc.model.Model;
import com.sun.xml.bind.v2.model.core.ID;
import org.glassfish.jaxb.core.v2.model.core.ID;

public class SimplifyPlugin extends AbstractParameterizablePlugin {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import com.sun.tools.xjc.model.CPropertyInfo;
import com.sun.tools.xjc.model.CReferencePropertyInfo;
import com.sun.tools.xjc.model.Model;
import com.sun.xml.bind.v2.model.core.WildcardMode;
import org.glassfish.jaxb.core.v2.model.core.WildcardMode;

public class WildcardPlugin extends AbstractParameterizablePlugin {

Expand Down
2 changes: 1 addition & 1 deletion basics/basic/src/test/resources/schema.xsd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb"
jaxb:version="1.0">

<xs:annotation>
Expand Down
1 change: 0 additions & 1 deletion basics/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
<modules>
<module>samples</module>
<module>tests</module>
<module>dist</module>
</modules>
</profile>
</profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import java.io.StringWriter;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Marshaller;

public class ContextUtils {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.JAXBElement;
import jakarta.xml.bind.JAXBElement;

import org.jvnet.jaxb2_commons.locator.ObjectLocator;
import org.w3c.dom.Node;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.Iterator;
import java.util.List;

import javax.xml.bind.JAXBElement;
import jakarta.xml.bind.JAXBElement;

import org.jvnet.jaxb2_commons.locator.ObjectLocator;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import java.util.List;

import javax.xml.bind.JAXBElement;
import jakarta.xml.bind.JAXBElement;

import org.jvnet.jaxb2_commons.locator.ObjectLocator;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.jvnet.jaxb2_commons.lang;

import javax.xml.bind.JAXBElement;
import jakarta.xml.bind.JAXBElement;

import org.jvnet.jaxb2_commons.locator.ObjectLocator;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.jvnet.jaxb2_commons.locator;

import javax.xml.bind.ValidationEventLocator;
import jakarta.xml.bind.ValidationEventLocator;

import org.jvnet.jaxb2_commons.i18n.Reportable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.jvnet.jaxb2_commons.xml.bind;

import javax.xml.bind.Marshaller;
import jakarta.xml.bind.Marshaller;

public interface AfterMarshallCallback {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.jvnet.jaxb2_commons.xml.bind;

import javax.xml.bind.Unmarshaller;
import jakarta.xml.bind.Unmarshaller;

public interface AfterUnmarshallCallback {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.jvnet.jaxb2_commons.xml.bind;

import javax.xml.bind.Marshaller;
import jakarta.xml.bind.Marshaller;

public interface BeforeMarshallCallback {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.jvnet.jaxb2_commons.xml.bind;

import javax.xml.bind.Unmarshaller;
import jakarta.xml.bind.Unmarshaller;

public interface BeforeUnmarshallCallback {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.util.LinkedList;
import java.util.List;

import javax.xml.bind.annotation.adapters.XmlAdapter;
import jakarta.xml.bind.annotation.adapters.XmlAdapter;

import org.jvnet.jaxb2_commons.lang.StringUtils;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.PropertyInfoOrigin;
import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin;

import com.sun.xml.bind.v2.model.core.ClassInfo;
import com.sun.xml.bind.v2.model.core.PropertyInfo;
import org.glassfish.jaxb.core.v2.model.core.ClassInfo;
import org.glassfish.jaxb.core.v2.model.core.PropertyInfo;

public class CMClassInfo<T, C extends T> implements MClassInfo<T, C> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumLeafInfoOrigin;
import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin;

import com.sun.xml.bind.v2.model.core.EnumConstant;
import com.sun.xml.bind.v2.model.core.EnumLeafInfo;
import org.glassfish.jaxb.core.v2.model.core.EnumConstant;
import org.glassfish.jaxb.core.v2.model.core.EnumLeafInfo;

public class CMEnumLeafInfo<T, C extends T> implements MEnumLeafInfo<T, C>,
MCustomizable {
Expand Down
Loading