XMLBEANS-555 - Partial method support + Refactor Factory inner classes to instance reference in generated beans
git-svn-id: https://svn.apache.org/repos/asf/xmlbeans/trunk@1886771 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/build.xml b/build.xml
index f60478e..83d817f 100644
--- a/build.xml
+++ b/build.xml
@@ -332,6 +332,9 @@
<replaceregexp match="^.*@deprecated.*\r?\n.*\r?\n" replace="" flags="gm">
<fileset dir="build/bootstrap/generated-sources" includes="**/*.java"/>
</replaceregexp>
+ <replaceregexp match='^(\s+).*type =[^\n]*\r?\n.*\((.*)\.class[^"]+"([^"]+)"[^"]+("[^"]+").*$' replace="\1org.apache.xmlbeans.impl.schema.XmlObjectFactory<\2> Factory = new org.apache.xmlbeans.impl.schema.XmlObjectFactory<>(\3.TypeSystemHolder.typeSystem, \4); \1org.apache.xmlbeans.SchemaType type = Factory.getType();" flags="gm">
+ <fileset dir="build/bootstrap/generated-sources" includes="**/*.java" excludes="**/impl/xb/*/impl/**"/>
+ </replaceregexp>
<replace dir="build/bootstrap/generated-sources" token=" enumValue()" value=" getEnumValue()" includes="**/*.java"/>
<replace dir="build/bootstrap/generated-sources" token=" set(org.apache.xmlbeans.StringEnumAbstractBase" value=" setEnumValue(org.apache.xmlbeans.StringEnumAbstractBase" includes="**/*.java"/>
<replace dir="build/bootstrap/generated-sources" token="java.util.List list" value="java.util.List<?> list" includes="**/*.java"/>
@@ -382,8 +385,8 @@
<schemaCompProd classpathref="oldschemas" dest="build"/>
- <!-- delete old schema classes -->
- <delete dir="build/classes/org/apache/xmlbeans/impl/xb"/>
+ <!-- delete old schema classes and classes referencing on them -->
+ <delete dir="build/classes/org/apache/xmlbeans" excludes="metadata/**"/>
</target>
<target name="compile" depends="process-resources" description="Compile sources and resources">
@@ -400,6 +403,8 @@
<src refid="sources"/>
<classpath path="${saxon.jar}"/>
<classpath path="${slf4j-api.jar}"/>
+ <classpath path="${javaparser.core.jar}"/>
+ <classpath path="${ant.jar}"/>
</javac>
<javac release="9"
@@ -763,6 +768,7 @@
<exclude name="test/resources/xbean/dom/W3C/level2/core/files/**"/>
<exclude name="test/resources/xbean/xmlobject/soap-envelope.xsd"/>
<exclude name="test/resources/xbean/xmlobject/soap12-encoding.xsd"/>
+ <exclude name="test/resources/xbean/compile/scomp/partials/**"/>
</fileset>
</rat:report>
diff --git a/src/main/java/org/apache/xmlbeans/SchemaCodePrinter.java b/src/main/java/org/apache/xmlbeans/SchemaCodePrinter.java
index 67821e7..f04c322 100755
--- a/src/main/java/org/apache/xmlbeans/SchemaCodePrinter.java
+++ b/src/main/java/org/apache/xmlbeans/SchemaCodePrinter.java
@@ -24,8 +24,23 @@
*/
public interface SchemaCodePrinter {
- void printTypeImpl(Writer writer, SchemaType sType) throws IOException;
+ // implement a method of each pair ... otherwise a stackoverflow is inevitable ...
+ @Deprecated
+ default void printTypeImpl(Writer writer, SchemaType sType) throws IOException {
+ printTypeImpl(writer, sType, null);
+ }
- void printType(Writer writer, SchemaType sType) throws IOException;
+ default void printTypeImpl(Writer writer, SchemaType sType, XmlOptions opt) throws IOException {
+ printTypeImpl(writer, sType);
+ }
+
+ @Deprecated
+ default void printType(Writer writer, SchemaType sType) throws IOException {
+ printType(writer, sType, null);
+ }
+
+ default void printType(Writer writer, SchemaType sType, XmlOptions opt) throws IOException {
+ printType(writer, sType);
+ }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlAnySimpleType.java b/src/main/java/org/apache/xmlbeans/XmlAnySimpleType.java
index b4d8a01..95678af 100644
--- a/src/main/java/org/apache/xmlbeans/XmlAnySimpleType.java
+++ b/src/main/java/org/apache/xmlbeans/XmlAnySimpleType.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-1/#Simple_Type_Definition">xs:anySimpleType</a> type.
@@ -22,10 +24,11 @@
* All simple types are convertible to {@link String}.
*/
public interface XmlAnySimpleType extends XmlObject {
+ XmlObjectFactory<XmlAnySimpleType> Factory = new XmlObjectFactory<>("_BI_anySimpleType");
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_anySimpleType");
+ SchemaType type = Factory.getType();
/**
* Returns the value as a {@link String}
@@ -36,134 +39,5 @@
* Sets the value as a {@link String}
**/
void setStringValue(String s);
-
- /**
- * A class with methods for creating instances
- * of {@link XmlAnySimpleType}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlAnySimpleType}
- */
- public static XmlAnySimpleType newInstance() {
- return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlAnySimpleType}
- */
- public static XmlAnySimpleType newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlAnySimpleType} value
- */
- public static XmlAnySimpleType newValue(Object obj) {
- return type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlAnySimpleType} fragment from a String. For example: "<code><xml-fragment>anything</xml-fragment></code>".
- */
- public static XmlAnySimpleType parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlAnySimpleType} fragment from a String. For example: "<code><xml-fragment>anything</xml-fragment></code>".
- */
- public static XmlAnySimpleType parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlAnySimpleType} fragment from a File.
- */
- public static XmlAnySimpleType parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlAnySimpleType} fragment from a File.
- */
- public static XmlAnySimpleType parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlAnySimpleType} fragment from a URL.
- */
- public static XmlAnySimpleType parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlAnySimpleType} fragment from a URL.
- */
- public static XmlAnySimpleType parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlAnySimpleType} fragment from an InputStream.
- */
- public static XmlAnySimpleType parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlAnySimpleType} fragment from an InputStream.
- */
- public static XmlAnySimpleType parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlAnySimpleType} fragment from a Reader.
- */
- public static XmlAnySimpleType parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlAnySimpleType} fragment from a Reader.
- */
- public static XmlAnySimpleType parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlAnySimpleType} fragment from a DOM Node.
- */
- public static XmlAnySimpleType parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlAnySimpleType} fragment from a DOM Node.
- */
- public static XmlAnySimpleType parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlAnySimpleType} fragment from an XMLStreamReader.
- */
- public static XmlAnySimpleType parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlAnySimpleType} fragment from an XMLStreamReader.
- */
- public static XmlAnySimpleType parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlAnyURI.java b/src/main/java/org/apache/xmlbeans/XmlAnyURI.java
index 8fbe686..993c3e5 100644
--- a/src/main/java/org/apache/xmlbeans/XmlAnyURI.java
+++ b/src/main/java/org/apache/xmlbeans/XmlAnyURI.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#anyURI">xs:anyURI</a> type.
@@ -22,138 +24,11 @@
* Convertible to {@link String}.
*/
public interface XmlAnyURI extends XmlAnySimpleType {
+ XmlObjectFactory<XmlAnyURI> Factory = new XmlObjectFactory<>("_BI_anyURI");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_anyURI");
-
- /**
- * A class with methods for creating instances
- * of {@link XmlAnyURI}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlAnyURI}
- */
- public static XmlAnyURI newInstance() {
- return (XmlAnyURI) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlAnyURI}
- */
- public static XmlAnyURI newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlAnyURI) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlAnyURI} value
- */
- public static XmlAnyURI newValue(Object obj) {
- return (XmlAnyURI) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlAnyURI} fragment from a String. For example: "<code><xml-fragment>http://www.w3.org/</xml-fragment></code>".
- */
- public static XmlAnyURI parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlAnyURI} fragment from a String. For example: "<code><xml-fragment>http://www.w3.org/</xml-fragment></code>".
- */
- public static XmlAnyURI parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlAnyURI} fragment from a File.
- */
- public static XmlAnyURI parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlAnyURI} fragment from a File.
- */
- public static XmlAnyURI parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlAnyURI} fragment from a URL.
- */
- public static XmlAnyURI parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlAnyURI} fragment from a URL.
- */
- public static XmlAnyURI parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlAnyURI} fragment from an InputStream.
- */
- public static XmlAnyURI parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlAnyURI} fragment from an InputStream.
- */
- public static XmlAnyURI parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlAnyURI} fragment from a Reader.
- */
- public static XmlAnyURI parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlAnyURI} fragment from a Reader.
- */
- public static XmlAnyURI parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlAnyURI} fragment from a DOM Node.
- */
- public static XmlAnyURI parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlAnyURI} fragment from a DOM Node.
- */
- public static XmlAnyURI parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlAnyURI} fragment from an XMLStreamReader.
- */
- public static XmlAnyURI parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlAnyURI} fragment from an XMLStreamReader.
- */
- public static XmlAnyURI parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
+ SchemaType type = Factory.getType();
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlBeans.java b/src/main/java/org/apache/xmlbeans/XmlBeans.java
index 79c056f..c8749c0 100644
--- a/src/main/java/org/apache/xmlbeans/XmlBeans.java
+++ b/src/main/java/org/apache/xmlbeans/XmlBeans.java
@@ -232,7 +232,7 @@
* linking, and returns a unioned typeloader that is suitable for
* creating instances.
*/
- public static SchemaTypeLoader loadXsd(XmlObject[] schemas) throws XmlException {
+ public static SchemaTypeLoader loadXsd(XmlObject... schemas) throws XmlException {
return loadXsd(schemas, null);
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlBoolean.java b/src/main/java/org/apache/xmlbeans/XmlBoolean.java
index 9d84b6f..b32cb4b 100644
--- a/src/main/java/org/apache/xmlbeans/XmlBoolean.java
+++ b/src/main/java/org/apache/xmlbeans/XmlBoolean.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#boolean">xs:boolean</a> type.
@@ -22,6 +24,8 @@
* Naturally, convertible to Java boolean.
*/
public interface XmlBoolean extends XmlAnySimpleType {
+ XmlObjectFactory<XmlBoolean> Factory = new XmlObjectFactory<>("_BI_boolean");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
@@ -36,134 +40,5 @@
* Sets this value as a boolean
*/
void setBooleanValue(boolean v);
-
- /**
- * A class with methods for creating instances
- * of {@link XmlBoolean}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlBoolean}
- */
- public static XmlBoolean newInstance() {
- return (XmlBoolean) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlBoolean}
- */
- public static XmlBoolean newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlBoolean) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlBoolean} value
- */
- public static XmlBoolean newValue(Object obj) {
- return (XmlBoolean) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlBoolean} fragment from a String. For example: "<code><xml-fragment>true</xml-fragment></code>".
- */
- public static XmlBoolean parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlBoolean) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlBoolean} fragment from a String. For example: "<code><xml-fragment>true</xml-fragment></code>".
- */
- public static XmlBoolean parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlBoolean) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlBoolean} fragment from a File.
- */
- public static XmlBoolean parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlBoolean) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlBoolean} fragment from a File.
- */
- public static XmlBoolean parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlBoolean) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlBoolean} fragment from a URL.
- */
- public static XmlBoolean parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlBoolean) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlBoolean} fragment from a URL.
- */
- public static XmlBoolean parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlBoolean) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlBoolean} fragment from an InputStream.
- */
- public static XmlBoolean parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlBoolean) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlBoolean} fragment from an InputStream.
- */
- public static XmlBoolean parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlBoolean) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlBoolean} fragment from a Reader.
- */
- public static XmlBoolean parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlBoolean) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlBoolean} fragment from a Reader.
- */
- public static XmlBoolean parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlBoolean) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlBoolean} fragment from a DOM Node.
- */
- public static XmlBoolean parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlBoolean) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlBoolean} fragment from a DOM Node.
- */
- public static XmlBoolean parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlBoolean) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlBoolean} fragment from an XMLStreamReader.
- */
- public static XmlBoolean parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlBoolean) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlBoolean} fragment from an XMLStreamReader.
- */
- public static XmlBoolean parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlBoolean) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlByte.java b/src/main/java/org/apache/xmlbeans/XmlByte.java
index 05093e6..dfa999b 100644
--- a/src/main/java/org/apache/xmlbeans/XmlByte.java
+++ b/src/main/java/org/apache/xmlbeans/XmlByte.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#byte">xs:byte</a> type.
@@ -22,10 +24,12 @@
* Naturally, convertible to Java byte.
*/
public interface XmlByte extends XmlShort {
+ XmlObjectFactory<XmlByte> Factory = new XmlObjectFactory<>("_BI_byte");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_byte");
+ SchemaType type = Factory.getType();
/**
* Returns this value as a byte
@@ -36,134 +40,5 @@
* Sets this value as a byte
*/
void setByteValue(byte s);
-
- /**
- * A class with methods for creating instances
- * of {@link XmlByte}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlByte}
- */
- static XmlByte newInstance() {
- return (XmlByte) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlByte}
- */
- static XmlByte newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlByte) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlByte} value
- */
- static XmlByte newValue(Object obj) {
- return (XmlByte) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlByte} fragment from a String. For example: "<code><xml-fragment>123</xml-fragment></code>".
- */
- static XmlByte parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlByte) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlByte} fragment from a String. For example: "<code><xml-fragment>123</xml-fragment></code>".
- */
- static XmlByte parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlByte) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlByte} fragment from a File.
- */
- static XmlByte parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlByte) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlByte} fragment from a File.
- */
- static XmlByte parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlByte) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlByte} fragment from a URL.
- */
- static XmlByte parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlByte) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlByte} fragment from a URL.
- */
- static XmlByte parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlByte) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlByte} fragment from an InputStream.
- */
- static XmlByte parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlByte) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlByte} fragment from an InputStream.
- */
- static XmlByte parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlByte) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlByte} fragment from a Reader.
- */
- static XmlByte parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlByte) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlByte} fragment from a Reader.
- */
- static XmlByte parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlByte) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlByte} fragment from a DOM Node.
- */
- static XmlByte parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlByte) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlByte} fragment from a DOM Node.
- */
- static XmlByte parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlByte) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlByte} fragment from an XMLStreamReader.
- */
- static XmlByte parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlByte) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlByte} fragment from an XMLStreamReader.
- */
- static XmlByte parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlByte) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlCalendar.java b/src/main/java/org/apache/xmlbeans/XmlCalendar.java
index b450ba5..8720da7 100644
--- a/src/main/java/org/apache/xmlbeans/XmlCalendar.java
+++ b/src/main/java/org/apache/xmlbeans/XmlCalendar.java
@@ -15,11 +15,11 @@
package org.apache.xmlbeans;
-import java.util.GregorianCalendar;
+import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;
+import java.util.GregorianCalendar;
import java.util.TimeZone;
-import java.math.BigDecimal;
/**
* An XML Schema compatible subclass of {@link java.util.GregorianCalendar GregorianCalendar}.
@@ -56,8 +56,8 @@
* from {@link GregorianCalendar}, which chooses 1970. The reason 0 is preferable
* is that it is a leap year and so it permits the date --2-29 to be specified
* stably. A different default year can be chosen via the static method
- * {@link #setDefaultYear(int) XmlCalendar.setDefaultYear()}, or by setting the
- * system property "user.defaultyear". If you do change this value, you should
+ * {@link #setDefaultYear(int) XmlCalendar.setDefaultYear()}, or by setting the
+ * system property "user.defaultyear". If you do change this value, you should
* pick another leap year such as 2000 and avoid non-leap years such as 1900.
* </li>
* <li>
@@ -78,32 +78,32 @@
* of information.
* </li>
* </ol>
- */
+ */
public class XmlCalendar extends GregorianCalendar
{
/**
* Constructs an XmlCalendar for a standard XML
* schema formatted date string.
- *
+ *
* The parser accepts any of the following formats:
- *
+ *
* YYYY-MM-DDThh:mm:ss - dateTime
* YYYY-MM-DD - date
* hh:mm:ss - time
* YYYY - gYear
* --MM - gMonth
* ---DD - gDay
- *
+ *
* The parser actually accepts all 16 combinations of subsets of
* fields (Y, M, D, T) using the same scheme, even for combinations
* that are not defined as types in the schema spec, such as
* year, day, and time:
- *
+ *
* YYYY--DDThh:mm:ss - [everything but month specified]
- *
+ *
* In the string, each field must be padded to its full width, for
* example, January must be --01, not just --1.
- *
+ *
* In particular, a year must be padded to at least four digits, so
* "98" is not a valid year, although "1998" and "0098" are both valid
* years, unambiguously 19 centuries separated from each other. A year
@@ -115,34 +115,34 @@
* or simple offsets from UTC in the range "-14:00" to "+14:00",
* for example: "14:30:00-05:00" specifies 2:30 PM in the
* afternoon at UTC-05:00, which is the same as EST.
- *
+ *
* If a timezone is not specified, the default TimeZone is used.
- */
+ */
public XmlCalendar(String xmlSchemaDateString)
{
this(new GDate(xmlSchemaDateString)); // use GDate to parse
}
-
+
/**
* Constructs an XmlCalendar from a GDate.
- *
+ *
* If the instance is not completed, you can round-trip to an
* equivalent GDate by writing "new GDate(new XmlCalendar(gdate))".
* However, if you access any of the unset fields of the calendar, all
* the fields will be automatically filled in, so partial dates
* without timezones or other fields will not round-trip after access.
- */
+ */
public XmlCalendar(GDateSpecification date)
{
this(GDate.timeZoneForGDate(date), date);
}
-
+
private XmlCalendar(TimeZone tz, GDateSpecification date)
{
super(tz);
setGregorianChange(_beginningOfTime); // proleptic
clear();
-
+
if (date.hasYear())
{
int y = date.getYear(); // is never 0
@@ -176,10 +176,10 @@
set(Calendar.DST_OFFSET, 0); // note!! if we don't do this, then GregorianCalendar will pick up DST from the time zone
}
}
-
+
/**
* Constructs an XmlCalendar from a Date.
- *
+ *
* The default TimeZone is used for computing the various fields.
*/
public XmlCalendar(Date date)
@@ -187,7 +187,7 @@
this(TimeZone.getDefault(), new GDate(date));
complete();
}
-
+
/**
* Constructs an XmlCalendar with the specified year, month, day,
* hours, minutes, seconds, and optional fractional seconds, in
@@ -204,7 +204,7 @@
{
this(TimeZone.getDefault(), new GDate(year, month, day, hour, minute, second, fraction));
}
-
+
/**
* Constructs an XmlCalendar with the specified year, month, day,
* hours, minutes, seconds, and optional fractional seconds, in
@@ -224,11 +224,11 @@
{
this(new GDate(year, month, day, hour, minute, second, fraction, tzSign, tzHour, tzMinute));
}
-
+
/**
* Gets the value for a given time field.
- *
+ *
* Unlike the GregorianCalendar implementation, the get() does not
* force a complete of all fields. If you wish to force a completion
* of all the fields, call getTime() first.
@@ -243,19 +243,19 @@
/**
* Constructs an empty instance with no fields set.
- */
+ */
public XmlCalendar()
{
setGregorianChange(_beginningOfTime); // proleptic
clear();
}
-
+
private static int defaultYear = Integer.MIN_VALUE;
- private static final int DEFAULT_DEFAULT_YEAR = 0;
-
+ private static final int DEFAULT_DEFAULT_YEAR = 0;
+
/**
* Returns the default year that is used when no year is specified.
- */
+ */
public static int getDefaultYear()
{
if (defaultYear == Integer.MIN_VALUE)
@@ -275,19 +275,19 @@
}
return defaultYear;
}
-
+
/**
* Sets the default year to be used when no year is specified.
- */
+ */
public static void setDefaultYear(int year)
{
defaultYear = year;
}
-
+
/**
* Overrides GregorianCalendar.computeTime to apply a different
* default year. (It must be a leap year.)
- */
+ */
protected void computeTime()
{
boolean unsetYear = !isSet(YEAR);
@@ -303,9 +303,9 @@
clear(YEAR);
}
}
-
- private static Date _beginningOfTime = new Date(Long.MIN_VALUE);
-
+
+ private static final Date _beginningOfTime = new Date(Long.MIN_VALUE);
+
/**
* Prints the XmlCalendar using a standard XML Schema
* format, as described in XmlCalendar(String s).
diff --git a/src/main/java/org/apache/xmlbeans/XmlDate.java b/src/main/java/org/apache/xmlbeans/XmlDate.java
index 4314338..86ce6bd 100644
--- a/src/main/java/org/apache/xmlbeans/XmlDate.java
+++ b/src/main/java/org/apache/xmlbeans/XmlDate.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
import java.util.Calendar;
import java.util.Date;
@@ -29,10 +31,12 @@
* @see GDate
*/
public interface XmlDate extends XmlAnySimpleType {
+ XmlObjectFactory<XmlDate> Factory = new XmlObjectFactory<>("_BI_date");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_date");
+ SchemaType type = Factory.getType();
/**
* Returns this value as a {@link Calendar}
@@ -63,134 +67,5 @@
* Sets this value as a {@link Date}
*/
void setDateValue(Date d);
-
- /**
- * A class with methods for creating instances
- * of {@link XmlDate}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlDate}
- */
- public static XmlDate newInstance() {
- return (XmlDate) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlDate}
- */
- public static XmlDate newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlDate) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlDate} value
- */
- public static XmlDate newValue(Object obj) {
- return (XmlDate) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlDate} fragment from a String. For example: "<code><xml-fragment>2003-06-14</xml-fragment></code>".
- */
- public static XmlDate parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlDate) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlDate} fragment from a String. For example: "<code><xml-fragment>2003-06-14</xml-fragment></code>".
- */
- public static XmlDate parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlDate) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlDate} fragment from a File.
- */
- public static XmlDate parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDate) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlDate} fragment from a File.
- */
- public static XmlDate parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDate) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlDate} fragment from a URL.
- */
- public static XmlDate parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDate) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlDate} fragment from a URL.
- */
- public static XmlDate parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDate) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlDate} fragment from an InputStream.
- */
- public static XmlDate parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDate) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlDate} fragment from an InputStream.
- */
- public static XmlDate parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDate) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlDate} fragment from a Reader.
- */
- public static XmlDate parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDate) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlDate} fragment from a Reader.
- */
- public static XmlDate parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDate) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlDate} fragment from a DOM Node.
- */
- public static XmlDate parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlDate) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlDate} fragment from a DOM Node.
- */
- public static XmlDate parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlDate) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlDate} fragment from an XMLStreamReader.
- */
- public static XmlDate parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlDate) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlDate} fragment from an XMLStreamReader.
- */
- public static XmlDate parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlDate) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlDateTime.java b/src/main/java/org/apache/xmlbeans/XmlDateTime.java
index 8b58428..5b3123f 100644
--- a/src/main/java/org/apache/xmlbeans/XmlDateTime.java
+++ b/src/main/java/org/apache/xmlbeans/XmlDateTime.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
import java.util.Calendar;
import java.util.Date;
@@ -34,10 +36,12 @@
* @see GDuration
*/
public interface XmlDateTime extends XmlAnySimpleType {
+ XmlObjectFactory<XmlDateTime> Factory = new XmlObjectFactory<>("_BI_dateTime");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_dateTime");
+ SchemaType type = Factory.getType();
/**
* Returns this value as a {@link Calendar}
@@ -68,134 +72,5 @@
* Sets this value as a {@link Date}
*/
void setDateValue(Date d);
-
- /**
- * A class with methods for creating instances
- * of {@link XmlDateTime}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlDateTime}
- */
- public static XmlDateTime newInstance() {
- return (XmlDateTime) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlDateTime}
- */
- public static XmlDateTime newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlDateTime) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlDateTime} value
- */
- public static XmlDateTime newValue(Object obj) {
- return (XmlDateTime) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlDateTime} fragment from a String. For example: "<code><xml-fragment>2003-06-14T12:00:00</xml-fragment></code>".
- */
- public static XmlDateTime parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlDateTime) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlDateTime} fragment from a String. For example: "<code><xml-fragment>2003-06-14T12:00:00</xml-fragment></code>".
- */
- public static XmlDateTime parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlDateTime) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlDateTime} fragment from a File.
- */
- public static XmlDateTime parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDateTime) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlDateTime} fragment from a File.
- */
- public static XmlDateTime parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDateTime) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlDateTime} fragment from a URL.
- */
- public static XmlDateTime parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDateTime) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlDateTime} fragment from a URL.
- */
- public static XmlDateTime parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDateTime) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlDateTime} fragment from an InputStream.
- */
- public static XmlDateTime parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDateTime) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlDateTime} fragment from an InputStream.
- */
- public static XmlDateTime parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDateTime) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlDateTime} fragment from a Reader.
- */
- public static XmlDateTime parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDateTime) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlDateTime} fragment from a Reader.
- */
- public static XmlDateTime parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDateTime) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlDateTime} fragment from a DOM Node.
- */
- public static XmlDateTime parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlDateTime) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlDateTime} fragment from a DOM Node.
- */
- public static XmlDateTime parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlDateTime) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlDateTime} fragment from an XMLStreamReader.
- */
- public static XmlDateTime parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlDateTime) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlDateTime} fragment from an XMLStreamReader.
- */
- public static XmlDateTime parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlDateTime) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlDecimal.java b/src/main/java/org/apache/xmlbeans/XmlDecimal.java
index 21d38d7..5fe37cb 100644
--- a/src/main/java/org/apache/xmlbeans/XmlDecimal.java
+++ b/src/main/java/org/apache/xmlbeans/XmlDecimal.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
import java.math.BigDecimal;
/**
@@ -24,10 +26,12 @@
* Convertible to {@link BigDecimal}.
*/
public interface XmlDecimal extends XmlAnySimpleType {
+ XmlObjectFactory<XmlDecimal> Factory = new XmlObjectFactory<>("_BI_decimal");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_decimal");
+ SchemaType type = Factory.getType();
/**
* Returns this value as a {@link BigDecimal}
@@ -38,134 +42,5 @@
* Sets this value as a {@link BigDecimal}
*/
void setBigDecimalValue(BigDecimal bd);
-
- /**
- * A class with methods for creating instances
- * of {@link XmlDecimal}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlDecimal}
- */
- public static XmlDecimal newInstance() {
- return (XmlDecimal) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlDecimal}
- */
- public static XmlDecimal newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlDecimal) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlDecimal} value
- */
- public static XmlDecimal newValue(Object obj) {
- return (XmlDecimal) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlDecimal} fragment from a String. For example: "<code><xml-fragment>1234.56789</xml-fragment></code>".
- */
- public static XmlDecimal parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlDecimal) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlDecimal} fragment from a String. For example: "<code><xml-fragment>1234.56789</xml-fragment></code>".
- */
- public static XmlDecimal parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlDecimal) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlDecimal} fragment from a File.
- */
- public static XmlDecimal parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDecimal) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlDecimal} fragment from a File.
- */
- public static XmlDecimal parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDecimal) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlDecimal} fragment from a URL.
- */
- public static XmlDecimal parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDecimal) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlDecimal} fragment from a URL.
- */
- public static XmlDecimal parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDecimal) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlDecimal} fragment from an InputStream.
- */
- public static XmlDecimal parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDecimal) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlDecimal} fragment from an InputStream.
- */
- public static XmlDecimal parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDecimal) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlDecimal} fragment from a Reader.
- */
- public static XmlDecimal parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDecimal) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlDecimal} fragment from a Reader.
- */
- public static XmlDecimal parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDecimal) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlDecimal} fragment from a DOM Node.
- */
- public static XmlDecimal parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlDecimal) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlDecimal} fragment from a DOM Node.
- */
- public static XmlDecimal parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlDecimal) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlDecimal} fragment from an XMLStreamReader.
- */
- public static XmlDecimal parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlDecimal) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlDecimal} fragment from an XMLStreamReader.
- */
- public static XmlDecimal parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlDecimal) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlDouble.java b/src/main/java/org/apache/xmlbeans/XmlDouble.java
index 4d17298..24ebe2a 100644
--- a/src/main/java/org/apache/xmlbeans/XmlDouble.java
+++ b/src/main/java/org/apache/xmlbeans/XmlDouble.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#double">xs:double</a> type.
@@ -22,10 +24,12 @@
* Naturally, convertible to a Java double.
*/
public interface XmlDouble extends XmlAnySimpleType {
+ XmlObjectFactory<XmlDouble> Factory = new XmlObjectFactory<>("_BI_double");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_double");
+ SchemaType type = Factory.getType();
/**
* Returns this value as a double
@@ -36,134 +40,5 @@
* Sets this value as a double
*/
void setDoubleValue(double v);
-
- /**
- * A class with methods for creating instances
- * of {@link XmlDouble}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlDouble}
- */
- public static XmlDouble newInstance() {
- return (XmlDouble) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlDouble}
- */
- public static XmlDouble newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlDouble) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlDouble} value
- */
- public static XmlDouble newValue(Object obj) {
- return (XmlDouble) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlDouble} fragment from a String. For example: "<code><xml-fragment>123.34e+57</xml-fragment></code>".
- */
- public static XmlDouble parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlDouble) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlDouble} fragment from a String. For example: "<code><xml-fragment>123.34e+57</xml-fragment></code>".
- */
- public static XmlDouble parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlDouble) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlDouble} fragment from a File.
- */
- public static XmlDouble parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDouble) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlDouble} fragment from a File.
- */
- public static XmlDouble parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDouble) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlDouble} fragment from a URL.
- */
- public static XmlDouble parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDouble) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlDouble} fragment from a URL.
- */
- public static XmlDouble parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDouble) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlDouble} fragment from an InputStream.
- */
- public static XmlDouble parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDouble) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlDouble} fragment from an InputStream.
- */
- public static XmlDouble parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDouble) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlDouble} fragment from a Reader.
- */
- public static XmlDouble parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDouble) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlDouble} fragment from a Reader.
- */
- public static XmlDouble parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDouble) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlDouble} fragment from a DOM Node.
- */
- public static XmlDouble parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlDouble) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlDouble} fragment from a DOM Node.
- */
- public static XmlDouble parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlDouble) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlDouble} fragment from an XMLStreamReader.
- */
- public static XmlDouble parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlDouble) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlDouble} fragment from an XMLStreamReader.
- */
- public static XmlDouble parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlDouble) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlDuration.java b/src/main/java/org/apache/xmlbeans/XmlDuration.java
index 02241df..c366919 100644
--- a/src/main/java/org/apache/xmlbeans/XmlDuration.java
+++ b/src/main/java/org/apache/xmlbeans/XmlDuration.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#duration">xs:duration</a> type.
@@ -24,10 +26,12 @@
* @see GDuration
*/
public interface XmlDuration extends XmlAnySimpleType {
+ XmlObjectFactory<XmlDuration> Factory = new XmlObjectFactory<>("_BI_duration");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_duration");
+ SchemaType type = Factory.getType();
/**
* Returns this value as a {@link GDuration}
@@ -38,134 +42,5 @@
* Sets this value as a {@link GDuration}
*/
void setGDurationValue(GDuration gd);
-
- /**
- * A class with methods for creating instances
- * of {@link XmlDuration}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlDuration}
- */
- public static XmlDuration newInstance() {
- return (XmlDuration) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlDuration}
- */
- public static XmlDuration newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlDuration) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlDuration} value
- */
- public static XmlDuration newValue(Object obj) {
- return (XmlDuration) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlDuration} fragment from a String. For example: "<code><xml-fragment>P1Y2MT2H</xml-fragment></code>".
- */
- public static XmlDuration parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlDuration) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlDuration} fragment from a String. For example: "<code><xml-fragment>P1Y2MT2H</xml-fragment></code>".
- */
- public static XmlDuration parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlDuration) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlDuration} fragment from a File.
- */
- public static XmlDuration parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDuration) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlDuration} fragment from a File.
- */
- public static XmlDuration parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDuration) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlDuration} fragment from a URL.
- */
- public static XmlDuration parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDuration) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlDuration} fragment from a URL.
- */
- public static XmlDuration parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDuration) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlDuration} fragment from an InputStream.
- */
- public static XmlDuration parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDuration) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlDuration} fragment from an InputStream.
- */
- public static XmlDuration parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDuration) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlDuration} fragment from a Reader.
- */
- public static XmlDuration parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDuration) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlDuration} fragment from a Reader.
- */
- public static XmlDuration parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlDuration) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlDuration} fragment from a DOM Node.
- */
- public static XmlDuration parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlDuration) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlDuration} fragment from a DOM Node.
- */
- public static XmlDuration parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlDuration) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlDuration} fragment from an XMLStreamReader.
- */
- public static XmlDuration parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlDuration) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlDuration} fragment from an XMLStreamReader.
- */
- public static XmlDuration parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlDuration) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlENTITIES.java b/src/main/java/org/apache/xmlbeans/XmlENTITIES.java
index 4f037bc..310dc94 100644
--- a/src/main/java/org/apache/xmlbeans/XmlENTITIES.java
+++ b/src/main/java/org/apache/xmlbeans/XmlENTITIES.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
import java.util.List;
@@ -26,10 +28,12 @@
* A list type.
*/
public interface XmlENTITIES extends XmlAnySimpleType {
+ XmlObjectFactory<XmlENTITIES> Factory = new XmlObjectFactory<>("_BI_ENTITIES");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_ENTITIES");
+ SchemaType type = Factory.getType();
/**
* Returns the value as a {@link List} of {@link String} values
@@ -45,134 +49,5 @@
* Sets the value as a {@link List}
*/
void setListValue(List<?> l);
-
- /**
- * A class with methods for creating instances
- * of {@link XmlENTITIES}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlENTITIES}
- */
- public static XmlENTITIES newInstance() {
- return (XmlENTITIES) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlENTITIES}
- */
- public static XmlENTITIES newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlENTITIES) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlENTITIES} value
- */
- public static XmlENTITIES newValue(Object obj) {
- return (XmlENTITIES) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlENTITIES} fragment from a String.
- */
- public static XmlENTITIES parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlENTITIES} fragment from a String.
- */
- public static XmlENTITIES parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlENTITIES} fragment from a File.
- */
- public static XmlENTITIES parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlENTITIES} fragment from a File.
- */
- public static XmlENTITIES parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlENTITIES} fragment from a URL.
- */
- public static XmlENTITIES parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlENTITIES} fragment from a URL.
- */
- public static XmlENTITIES parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlENTITIES} fragment from an InputStream.
- */
- public static XmlENTITIES parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlENTITIES} fragment from an InputStream.
- */
- public static XmlENTITIES parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlENTITIES} fragment from a Reader.
- */
- public static XmlENTITIES parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlENTITIES} fragment from a Reader.
- */
- public static XmlENTITIES parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlENTITIES} fragment from a DOM Node.
- */
- public static XmlENTITIES parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlENTITIES} fragment from a DOM Node.
- */
- public static XmlENTITIES parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlENTITIES} fragment from an XMLStreamReader.
- */
- public static XmlENTITIES parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlENTITIES} fragment from an XMLStreamReader.
- */
- public static XmlENTITIES parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlENTITY.java b/src/main/java/org/apache/xmlbeans/XmlENTITY.java
index 955812e..9bf7aca 100644
--- a/src/main/java/org/apache/xmlbeans/XmlENTITY.java
+++ b/src/main/java/org/apache/xmlbeans/XmlENTITY.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#ENTITY">xs:ENTITY</a> type.
@@ -22,138 +24,11 @@
* Convertible to {@link String}.
*/
public interface XmlENTITY extends XmlNCName {
+ XmlObjectFactory<XmlENTITY> Factory = new XmlObjectFactory<>("_BI_ENTITY");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_ENTITY");
-
- /**
- * A class with methods for creating instances
- * of {@link XmlENTITY}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlENTITY}
- */
- public static XmlENTITY newInstance() {
- return (XmlENTITY) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlENTITY}
- */
- public static XmlENTITY newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlENTITY) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlENTITY} value
- */
- public static XmlENTITY newValue(Object obj) {
- return (XmlENTITY) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlENTITY} fragment from a String.
- */
- public static XmlENTITY parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlENTITY) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlENTITY} fragment from a String.
- */
- public static XmlENTITY parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlENTITY) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlENTITY} fragment from a File.
- */
- public static XmlENTITY parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlENTITY) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlENTITY} fragment from a File.
- */
- public static XmlENTITY parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlENTITY) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlENTITY} fragment from a URL.
- */
- public static XmlENTITY parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlENTITY) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlENTITY} fragment from a URL.
- */
- public static XmlENTITY parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlENTITY) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlENTITY} fragment from an InputStream.
- */
- public static XmlENTITY parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlENTITY) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlENTITY} fragment from an InputStream.
- */
- public static XmlENTITY parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlENTITY) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlENTITY} fragment from a Reader.
- */
- public static XmlENTITY parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlENTITY) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlENTITY} fragment from a Reader.
- */
- public static XmlENTITY parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlENTITY) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlENTITY} fragment from a DOM Node.
- */
- public static XmlENTITY parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlENTITY) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlENTITY} fragment from a DOM Node.
- */
- public static XmlENTITY parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlENTITY) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlENTITY} fragment from an XMLStreamReader.
- */
- public static XmlENTITY parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlENTITY) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlENTITY} fragment from an XMLStreamReader.
- */
- public static XmlENTITY parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlENTITY) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
+ SchemaType type = Factory.getType();
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlFloat.java b/src/main/java/org/apache/xmlbeans/XmlFloat.java
index a100bc2..f4e2ad5 100644
--- a/src/main/java/org/apache/xmlbeans/XmlFloat.java
+++ b/src/main/java/org/apache/xmlbeans/XmlFloat.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#float">xs:float</a> type.
@@ -22,10 +24,12 @@
* Naturally, convertible to a Java float.
*/
public interface XmlFloat extends XmlAnySimpleType {
+ XmlObjectFactory<XmlFloat> Factory = new XmlObjectFactory<>("_BI_float");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_float");
+ SchemaType type = Factory.getType();
/**
* Returns this value as a float
@@ -36,134 +40,5 @@
* Sets this value as a float
*/
void setFloatValue(float v);
-
- /**
- * A class with methods for creating instances
- * of {@link XmlFloat}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlFloat}
- */
- public static XmlFloat newInstance() {
- return (XmlFloat) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlFloat}
- */
- public static XmlFloat newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlFloat) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlFloat} value
- */
- public static XmlFloat newValue(Object obj) {
- return (XmlFloat) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlFloat} fragment from a String. For example: "<code><xml-fragment>12.34e+5</xml-fragment></code>".
- */
- public static XmlFloat parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlFloat) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlFloat} fragment from a String. For example: "<code><xml-fragment>12.34e+5</xml-fragment></code>".
- */
- public static XmlFloat parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlFloat) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlFloat} fragment from a File.
- */
- public static XmlFloat parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlFloat) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlFloat} fragment from a File.
- */
- public static XmlFloat parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlFloat) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlFloat} fragment from a URL.
- */
- public static XmlFloat parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlFloat) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlFloat} fragment from a URL.
- */
- public static XmlFloat parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlFloat) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlFloat} fragment from an InputStream.
- */
- public static XmlFloat parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlFloat) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlFloat} fragment from an InputStream.
- */
- public static XmlFloat parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlFloat) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlFloat} fragment from a Reader.
- */
- public static XmlFloat parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlFloat) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlFloat} fragment from a Reader.
- */
- public static XmlFloat parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlFloat) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlFloat} fragment from a DOM Node.
- */
- public static XmlFloat parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlFloat) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlFloat} fragment from a DOM Node.
- */
- public static XmlFloat parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlFloat) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlFloat} fragment from an XMLStreamReader.
- */
- public static XmlFloat parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlFloat) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlFloat} fragment from an XMLStreamReader.
- */
- public static XmlFloat parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlFloat) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlGDay.java b/src/main/java/org/apache/xmlbeans/XmlGDay.java
index 09effa7..1322ce5 100644
--- a/src/main/java/org/apache/xmlbeans/XmlGDay.java
+++ b/src/main/java/org/apache/xmlbeans/XmlGDay.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
import java.util.Calendar;
@@ -29,10 +31,12 @@
* @see GDate
*/
public interface XmlGDay extends XmlAnySimpleType {
+ XmlObjectFactory<XmlGDay> Factory = new XmlObjectFactory<>("_BI_gDay");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_gDay");
+ SchemaType type = Factory.getType();
/**
* Returns this value as a {@link Calendar}
@@ -63,134 +67,5 @@
* Sets this value as an int from 1-31
*/
void setIntValue(int v);
-
- /**
- * A class with methods for creating instances
- * of {@link XmlGDay}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlGDay}
- */
- public static XmlGDay newInstance() {
- return (XmlGDay) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlGDay}
- */
- public static XmlGDay newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlGDay) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlGDay} value
- */
- public static XmlGDay newValue(Object obj) {
- return (XmlGDay) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlGDay} fragment from a String. For example: "<code><xml-fragment>---14</xml-fragment></code>".
- */
- public static XmlGDay parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlGDay) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlGDay} fragment from a String. For example: "<code><xml-fragment>---14</xml-fragment></code>".
- */
- public static XmlGDay parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlGDay) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlGDay} fragment from a File.
- */
- public static XmlGDay parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGDay) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlGDay} fragment from a File.
- */
- public static XmlGDay parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGDay) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlGDay} fragment from a URL.
- */
- public static XmlGDay parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGDay) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlGDay} fragment from a URL.
- */
- public static XmlGDay parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGDay) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlGDay} fragment from an InputStream.
- */
- public static XmlGDay parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGDay) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlGDay} fragment from an InputStream.
- */
- public static XmlGDay parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGDay) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlGDay} fragment from a Reader.
- */
- public static XmlGDay parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGDay) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlGDay} fragment from a Reader.
- */
- public static XmlGDay parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGDay) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlGDay} fragment from a DOM Node.
- */
- public static XmlGDay parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlGDay) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlGDay} fragment from a DOM Node.
- */
- public static XmlGDay parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlGDay) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlGDay} fragment from an XMLStreamReader.
- */
- public static XmlGDay parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlGDay) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlGDay} fragment from an XMLStreamReader.
- */
- public static XmlGDay parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlGDay) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlGMonth.java b/src/main/java/org/apache/xmlbeans/XmlGMonth.java
index bb44425..8b8a09c 100644
--- a/src/main/java/org/apache/xmlbeans/XmlGMonth.java
+++ b/src/main/java/org/apache/xmlbeans/XmlGMonth.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
import java.util.Calendar;
@@ -29,10 +31,12 @@
* @see GDate
*/
public interface XmlGMonth extends XmlAnySimpleType {
+ XmlObjectFactory<XmlGMonth> Factory = new XmlObjectFactory<>("_BI_gMonth");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_gMonth");
+ SchemaType type = Factory.getType();
/**
* Returns this value as a {@link Calendar}
@@ -63,134 +67,5 @@
* Sets this value as an int from 1-12
*/
void setIntValue(int v);
-
- /**
- * A class with methods for creating instances
- * of {@link XmlGMonth}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlGMonth}
- */
- public static XmlGMonth newInstance() {
- return (XmlGMonth) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlGMonth}
- */
- public static XmlGMonth newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlGMonth) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlGMonth} value
- */
- public static XmlGMonth newValue(Object obj) {
- return (XmlGMonth) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlGMonth} fragment from a String. For example: "<code><xml-fragment>--06</xml-fragment></code>".
- */
- public static XmlGMonth parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlGMonth) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlGMonth} fragment from a String. For example: "<code><xml-fragment>--06</xml-fragment></code>".
- */
- public static XmlGMonth parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlGMonth) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlGMonth} fragment from a File.
- */
- public static XmlGMonth parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGMonth) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlGMonth} fragment from a File.
- */
- public static XmlGMonth parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGMonth) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlGMonth} fragment from a URL.
- */
- public static XmlGMonth parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGMonth) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlGMonth} fragment from a URL.
- */
- public static XmlGMonth parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGMonth) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlGMonth} fragment from an InputStream.
- */
- public static XmlGMonth parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGMonth) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlGMonth} fragment from an InputStream.
- */
- public static XmlGMonth parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGMonth) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlGMonth} fragment from a Reader.
- */
- public static XmlGMonth parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGMonth) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlGMonth} fragment from a Reader.
- */
- public static XmlGMonth parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGMonth) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlGMonth} fragment from a DOM Node.
- */
- public static XmlGMonth parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlGMonth) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlGMonth} fragment from a DOM Node.
- */
- public static XmlGMonth parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlGMonth) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlGMonth} fragment from an XMLStreamReader.
- */
- public static XmlGMonth parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlGMonth) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlGMonth} fragment from an XMLStreamReader.
- */
- public static XmlGMonth parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlGMonth) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlGMonthDay.java b/src/main/java/org/apache/xmlbeans/XmlGMonthDay.java
index 0ceaeb3..3dbdc03 100644
--- a/src/main/java/org/apache/xmlbeans/XmlGMonthDay.java
+++ b/src/main/java/org/apache/xmlbeans/XmlGMonthDay.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
import java.util.Calendar;
@@ -29,10 +31,12 @@
* @see GDate
*/
public interface XmlGMonthDay extends XmlAnySimpleType {
+ XmlObjectFactory<XmlGMonthDay> Factory = new XmlObjectFactory<>("_BI_gMonthDay");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_gMonthDay");
+ SchemaType type = Factory.getType();
/**
* Returns this value as a {@link Calendar}
@@ -53,134 +57,5 @@
* Sets this value as a {@link GDateSpecification}
*/
void setGDateValue(GDate gd);
-
- /**
- * A class with methods for creating instances
- * of {@link XmlGMonthDay}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlGMonthDay}
- */
- public static XmlGMonthDay newInstance() {
- return (XmlGMonthDay) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlGMonthDay}
- */
- public static XmlGMonthDay newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlGMonthDay) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlGMonthDay} value
- */
- public static XmlGMonthDay newValue(Object obj) {
- return (XmlGMonthDay) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlGMonthDay} fragment from a String. For example: "<code><xml-fragment>--06-14</xml-fragment></code>".
- */
- public static XmlGMonthDay parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlGMonthDay} fragment from a String. For example: "<code><xml-fragment>--06-14</xml-fragment></code>".
- */
- public static XmlGMonthDay parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlGMonthDay} fragment from a File.
- */
- public static XmlGMonthDay parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlGMonthDay} fragment from a File.
- */
- public static XmlGMonthDay parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlGMonthDay} fragment from a URL.
- */
- public static XmlGMonthDay parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlGMonthDay} fragment from a URL.
- */
- public static XmlGMonthDay parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlGMonthDay} fragment from an InputStream.
- */
- public static XmlGMonthDay parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlGMonthDay} fragment from an InputStream.
- */
- public static XmlGMonthDay parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlGMonthDay} fragment from a Reader.
- */
- public static XmlGMonthDay parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlGMonthDay} fragment from a Reader.
- */
- public static XmlGMonthDay parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlGMonthDay} fragment from a DOM Node.
- */
- public static XmlGMonthDay parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlGMonthDay} fragment from a DOM Node.
- */
- public static XmlGMonthDay parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlGMonthDay} fragment from an XMLStreamReader.
- */
- public static XmlGMonthDay parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlGMonthDay} fragment from an XMLStreamReader.
- */
- public static XmlGMonthDay parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlGYear.java b/src/main/java/org/apache/xmlbeans/XmlGYear.java
index 6ae72b8..9edc752 100644
--- a/src/main/java/org/apache/xmlbeans/XmlGYear.java
+++ b/src/main/java/org/apache/xmlbeans/XmlGYear.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
import java.util.Calendar;
@@ -29,10 +31,12 @@
* @see GDate
*/
public interface XmlGYear extends XmlAnySimpleType {
+ XmlObjectFactory<XmlGYear> Factory = new XmlObjectFactory<>("_BI_gYear");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_gYear");
+ SchemaType type = Factory.getType();
/**
* Returns this value as a {@link Calendar}
@@ -63,134 +67,5 @@
* Sets this value as an int from 1-31
*/
void setIntValue(int v);
-
- /**
- * A class with methods for creating instances
- * of {@link XmlGYear}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlGYear}
- */
- public static XmlGYear newInstance() {
- return (XmlGYear) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlGYear}
- */
- public static XmlGYear newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlGYear) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlGYear} value
- */
- public static XmlGYear newValue(Object obj) {
- return (XmlGYear) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlGYear} fragment from a String. For example: "<code><xml-fragment>2003</xml-fragment></code>".
- */
- public static XmlGYear parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlGYear) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlGYear} fragment from a String. For example: "<code><xml-fragment>2003</xml-fragment></code>".
- */
- public static XmlGYear parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlGYear) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlGYear} fragment from a File.
- */
- public static XmlGYear parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGYear) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlGYear} fragment from a File.
- */
- public static XmlGYear parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGYear) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlGYear} fragment from a URL.
- */
- public static XmlGYear parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGYear) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlGYear} fragment from a URL.
- */
- public static XmlGYear parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGYear) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlGYear} fragment from an InputStream.
- */
- public static XmlGYear parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGYear) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlGYear} fragment from an InputStream.
- */
- public static XmlGYear parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGYear) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlGYear} fragment from a Reader.
- */
- public static XmlGYear parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGYear) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlGYear} fragment from a Reader.
- */
- public static XmlGYear parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGYear) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlGYear} fragment from a DOM Node.
- */
- public static XmlGYear parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlGYear) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlGYear} fragment from a DOM Node.
- */
- public static XmlGYear parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlGYear) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlGYear} fragment from an XMLStreamReader.
- */
- public static XmlGYear parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlGYear) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlGYear} fragment from an XMLStreamReader.
- */
- public static XmlGYear parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlGYear) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlGYearMonth.java b/src/main/java/org/apache/xmlbeans/XmlGYearMonth.java
index 8e318ce..d4bf2cd 100644
--- a/src/main/java/org/apache/xmlbeans/XmlGYearMonth.java
+++ b/src/main/java/org/apache/xmlbeans/XmlGYearMonth.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
import java.util.Calendar;
@@ -29,10 +31,12 @@
* @see GDate
*/
public interface XmlGYearMonth extends XmlAnySimpleType {
+ XmlObjectFactory<XmlGYearMonth> Factory = new XmlObjectFactory<>("_BI_gYearMonth");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_gYearMonth");
+ SchemaType type = Factory.getType();
/**
* Returns this value as a {@link Calendar}
@@ -53,134 +57,5 @@
* Sets this value as a {@link GDateSpecification}
*/
void setGDateValue(GDate gd);
-
- /**
- * A class with methods for creating instances
- * of {@link XmlGYearMonth}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlGYearMonth}
- */
- public static XmlGYearMonth newInstance() {
- return (XmlGYearMonth) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlGYearMonth}
- */
- public static XmlGYearMonth newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlGYearMonth) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlGYearMonth} value
- */
- public static XmlGYearMonth newValue(Object obj) {
- return (XmlGYearMonth) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlGYearMonth} fragment from a String. For example: "<code><xml-fragment>2003-06</xml-fragment></code>".
- */
- public static XmlGYearMonth parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlGYearMonth} fragment from a String. For example: "<code><xml-fragment>2003-06</xml-fragment></code>".
- */
- public static XmlGYearMonth parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlGYearMonth} fragment from a File.
- */
- public static XmlGYearMonth parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlGYearMonth} fragment from a File.
- */
- public static XmlGYearMonth parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlGYearMonth} fragment from a URL.
- */
- public static XmlGYearMonth parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlGYearMonth} fragment from a URL.
- */
- public static XmlGYearMonth parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlGYearMonth} fragment from an InputStream.
- */
- public static XmlGYearMonth parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlGYearMonth} fragment from an InputStream.
- */
- public static XmlGYearMonth parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlGYearMonth} fragment from a Reader.
- */
- public static XmlGYearMonth parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlGYearMonth} fragment from a Reader.
- */
- public static XmlGYearMonth parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlGYearMonth} fragment from a DOM Node.
- */
- public static XmlGYearMonth parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlGYearMonth} fragment from a DOM Node.
- */
- public static XmlGYearMonth parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlGYearMonth} fragment from an XMLStreamReader.
- */
- public static XmlGYearMonth parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlGYearMonth} fragment from an XMLStreamReader.
- */
- public static XmlGYearMonth parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlHexBinary.java b/src/main/java/org/apache/xmlbeans/XmlHexBinary.java
index acc9487..2db41ef 100644
--- a/src/main/java/org/apache/xmlbeans/XmlHexBinary.java
+++ b/src/main/java/org/apache/xmlbeans/XmlHexBinary.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#hexBinary">xs:hexBinary</a> type.
@@ -22,10 +24,12 @@
* Convertible to a byte array.
*/
public interface XmlHexBinary extends XmlAnySimpleType {
+ XmlObjectFactory<XmlHexBinary> Factory = new XmlObjectFactory<>("_BI_hexBinary");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_hexBinary");
+ SchemaType type = Factory.getType();
/**
* Returns this value as a byte array.
@@ -36,135 +40,5 @@
* Sets this value as a byte array.
*/
void setByteArrayValue(byte[] ba);
-
-
- /**
- * A class with methods for creating instances
- * of {@link XmlHexBinary}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlHexBinary}
- */
- public static XmlHexBinary newInstance() {
- return (XmlHexBinary) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlHexBinary}
- */
- public static XmlHexBinary newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlHexBinary) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlHexBinary} value
- */
- public static XmlHexBinary newValue(Object obj) {
- return (XmlHexBinary) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlHexBinary} fragment from a String. For example: "<code><xml-fragment>68656c6c6f</xml-fragment></code>".
- */
- public static XmlHexBinary parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlHexBinary} fragment from a String. For example: "<code><xml-fragment>68656c6c6f</xml-fragment></code>".
- */
- public static XmlHexBinary parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlHexBinary} fragment from a File.
- */
- public static XmlHexBinary parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlHexBinary} fragment from a File.
- */
- public static XmlHexBinary parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlHexBinary} fragment from a URL.
- */
- public static XmlHexBinary parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlHexBinary} fragment from a URL.
- */
- public static XmlHexBinary parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlHexBinary} fragment from an InputStream.
- */
- public static XmlHexBinary parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlHexBinary} fragment from an InputStream.
- */
- public static XmlHexBinary parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlHexBinary} fragment from a Reader.
- */
- public static XmlHexBinary parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlHexBinary} fragment from a Reader.
- */
- public static XmlHexBinary parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlHexBinary} fragment from a DOM Node.
- */
- public static XmlHexBinary parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlHexBinary} fragment from a DOM Node.
- */
- public static XmlHexBinary parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlHexBinary} fragment from an XMLStreamReader.
- */
- public static XmlHexBinary parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlHexBinary} fragment from an XMLStreamReader.
- */
- public static XmlHexBinary parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlID.java b/src/main/java/org/apache/xmlbeans/XmlID.java
index ef56e1c..c5ea415 100644
--- a/src/main/java/org/apache/xmlbeans/XmlID.java
+++ b/src/main/java/org/apache/xmlbeans/XmlID.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#ID">xs:ID</a> type.
@@ -25,138 +27,11 @@
* Convertible to a {@link String}.
*/
public interface XmlID extends XmlNCName {
+ XmlObjectFactory<XmlID> Factory = new XmlObjectFactory<>("_BI_ID");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_ID");
-
- /**
- * A class with methods for creating instances
- * of {@link XmlID}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlID}
- */
- public static XmlID newInstance() {
- return (XmlID) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlID}
- */
- public static XmlID newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlID) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlID} value
- */
- public static XmlID newValue(Object obj) {
- return (XmlID) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlID} fragment from a String. For example: "<code><xml-fragment>n1</xml-fragment></code>".
- */
- public static XmlID parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlID) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlID} fragment from a String. For example: "<code><xml-fragment>n1</xml-fragment></code>".
- */
- public static XmlID parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlID) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlID} fragment from a File.
- */
- public static XmlID parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlID) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlID} fragment from a File.
- */
- public static XmlID parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlID) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlID} fragment from a URL.
- */
- public static XmlID parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlID) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlID} fragment from a URL.
- */
- public static XmlID parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlID) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlID} fragment from an InputStream.
- */
- public static XmlID parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlID) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlID} fragment from an InputStream.
- */
- public static XmlID parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlID) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlID} fragment from a Reader.
- */
- public static XmlID parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlID) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlID} fragment from a Reader.
- */
- public static XmlID parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlID) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlID} fragment from a DOM Node.
- */
- public static XmlID parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlID) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlID} fragment from a DOM Node.
- */
- public static XmlID parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlID) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlID} fragment from an XMLStreamReader.
- */
- public static XmlID parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlID) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlID} fragment from an XMLStreamReader.
- */
- public static XmlID parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlID) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
+ SchemaType type = Factory.getType();
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlIDREF.java b/src/main/java/org/apache/xmlbeans/XmlIDREF.java
index 5d5f99f..aed62b3 100644
--- a/src/main/java/org/apache/xmlbeans/XmlIDREF.java
+++ b/src/main/java/org/apache/xmlbeans/XmlIDREF.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#IDREF">xs:IDREF</a> type.
@@ -26,138 +28,11 @@
* Convertible to a {@link String}.
*/
public interface XmlIDREF extends XmlNCName {
+ XmlObjectFactory<XmlIDREF> Factory = new XmlObjectFactory<>("_BI_IDREF");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_IDREF");
-
- /**
- * A class with methods for creating instances
- * of {@link XmlIDREF}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlIDREF}
- */
- public static XmlIDREF newInstance() {
- return (XmlIDREF) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlIDREF}
- */
- public static XmlIDREF newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlIDREF) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlIDREF} value
- */
- public static XmlIDREF newValue(Object obj) {
- return (XmlIDREF) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlIDREF} fragment from a String.
- */
- public static XmlIDREF parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlIDREF) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlIDREF} fragment from a String.
- */
- public static XmlIDREF parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlIDREF) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlIDREF} fragment from a File.
- */
- public static XmlIDREF parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlIDREF) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlIDREF} fragment from a File.
- */
- public static XmlIDREF parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlIDREF) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlIDREF} fragment from a URL.
- */
- public static XmlIDREF parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlIDREF) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlIDREF} fragment from a URL.
- */
- public static XmlIDREF parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlIDREF) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlIDREF} fragment from an InputStream.
- */
- public static XmlIDREF parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlIDREF) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlIDREF} fragment from an InputStream.
- */
- public static XmlIDREF parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlIDREF) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlIDREF} fragment from a Reader.
- */
- public static XmlIDREF parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlIDREF) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlIDREF} fragment from a Reader.
- */
- public static XmlIDREF parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlIDREF) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlIDREF} fragment from a DOM Node.
- */
- public static XmlIDREF parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlIDREF) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlIDREF} fragment from a DOM Node.
- */
- public static XmlIDREF parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlIDREF) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlIDREF} fragment from an XMLStreamReader.
- */
- public static XmlIDREF parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlIDREF) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlIDREF} fragment from an XMLStreamReader.
- */
- public static XmlIDREF parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlIDREF) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
+ SchemaType type = Factory.getType();
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlIDREFS.java b/src/main/java/org/apache/xmlbeans/XmlIDREFS.java
index 71592bd..ab850e3 100644
--- a/src/main/java/org/apache/xmlbeans/XmlIDREFS.java
+++ b/src/main/java/org/apache/xmlbeans/XmlIDREFS.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
import java.util.List;
@@ -30,10 +32,12 @@
* Convertible to a {@link List}.
*/
public interface XmlIDREFS extends XmlAnySimpleType {
+ XmlObjectFactory<XmlIDREFS> Factory = new XmlObjectFactory<>("_BI_IDREFS");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_IDREFS");
+ SchemaType type = Factory.getType();
/**
* Returns the value as a {@link List} of {@link String} values
@@ -49,134 +53,5 @@
* Sets the value as a {@link List}
*/
void setListValue(List<?> l);
-
- /**
- * A class with methods for creating instances
- * of {@link XmlIDREFS}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlIDREFS}
- */
- public static XmlIDREFS newInstance() {
- return (XmlIDREFS) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlIDREFS}
- */
- public static XmlIDREFS newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlIDREFS) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlIDREFS} value
- */
- public static XmlIDREFS newValue(Object obj) {
- return (XmlIDREFS) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlIDREFS} fragment from a String.
- */
- public static XmlIDREFS parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlIDREFS} fragment from a String.
- */
- public static XmlIDREFS parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlIDREFS} fragment from a File.
- */
- public static XmlIDREFS parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlIDREFS} fragment from a File.
- */
- public static XmlIDREFS parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlIDREFS} fragment from a URL.
- */
- public static XmlIDREFS parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlIDREFS} fragment from a URL.
- */
- public static XmlIDREFS parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlIDREFS} fragment from an InputStream.
- */
- public static XmlIDREFS parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlIDREFS} fragment from an InputStream.
- */
- public static XmlIDREFS parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlIDREFS} fragment from a Reader.
- */
- public static XmlIDREFS parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlIDREFS} fragment from a Reader.
- */
- public static XmlIDREFS parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlIDREFS} fragment from a DOM Node.
- */
- public static XmlIDREFS parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlIDREFS} fragment from a DOM Node.
- */
- public static XmlIDREFS parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlIDREFS} fragment from an XMLStreamReader.
- */
- public static XmlIDREFS parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlIDREFS} fragment from an XMLStreamReader.
- */
- public static XmlIDREFS parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlInt.java b/src/main/java/org/apache/xmlbeans/XmlInt.java
index 0052fe7..b73a27d 100644
--- a/src/main/java/org/apache/xmlbeans/XmlInt.java
+++ b/src/main/java/org/apache/xmlbeans/XmlInt.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#int">xs:int</a> type.
@@ -23,10 +25,12 @@
* Naturally, convertible to a Java int.
*/
public interface XmlInt extends XmlLong {
+ XmlObjectFactory<XmlInt> Factory = new XmlObjectFactory<>("_BI_int");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_int");
+ SchemaType type = Factory.getType();
/**
* Returns this value as an int
@@ -37,134 +41,5 @@
* Sets this value as an int
*/
void setIntValue(int v);
-
- /**
- * A class with methods for creating instances
- * of {@link XmlInt}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlInt}
- */
- public static XmlInt newInstance() {
- return (XmlInt) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlInt}
- */
- public static XmlInt newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlInt) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlInt} value
- */
- public static XmlInt newValue(Object obj) {
- return (XmlInt) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlInt} fragment from a String. For example: "<code><xml-fragment>1234567</xml-fragment></code>".
- */
- public static XmlInt parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlInt) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlInt} fragment from a String. For example: "<code><xml-fragment>1234567</xml-fragment></code>".
- */
- public static XmlInt parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlInt) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlInt} fragment from a File.
- */
- public static XmlInt parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlInt) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlInt} fragment from a File.
- */
- public static XmlInt parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlInt) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlInt} fragment from a URL.
- */
- public static XmlInt parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlInt) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlInt} fragment from a URL.
- */
- public static XmlInt parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlInt) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlInt} fragment from an InputStream.
- */
- public static XmlInt parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlInt) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlInt} fragment from an InputStream.
- */
- public static XmlInt parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlInt) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlInt} fragment from a Reader.
- */
- public static XmlInt parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlInt) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlInt} fragment from a Reader.
- */
- public static XmlInt parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlInt) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlInt} fragment from a DOM Node.
- */
- public static XmlInt parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlInt) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlInt} fragment from a DOM Node.
- */
- public static XmlInt parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlInt) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlInt} fragment from an XMLStreamReader.
- */
- public static XmlInt parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlInt) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlInt} fragment from an XMLStreamReader.
- */
- public static XmlInt parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlInt) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlInteger.java b/src/main/java/org/apache/xmlbeans/XmlInteger.java
index 93fed93..7384385 100644
--- a/src/main/java/org/apache/xmlbeans/XmlInteger.java
+++ b/src/main/java/org/apache/xmlbeans/XmlInteger.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
import java.math.BigInteger;
/**
@@ -29,10 +31,12 @@
* Convertible to a Java {@link BigInteger}.
*/
public interface XmlInteger extends XmlDecimal {
+ XmlObjectFactory<XmlInteger> Factory = new XmlObjectFactory<>("_BI_integer");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_integer");
+ SchemaType type = Factory.getType();
/**
* Returns this value as a {@link BigInteger}
@@ -43,134 +47,5 @@
* Sets this value as a {@link BigInteger}
*/
void setBigIntegerValue(BigInteger bi);
-
- /**
- * A class with methods for creating instances
- * of {@link XmlInteger}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlInteger}
- */
- public static XmlInteger newInstance() {
- return (XmlInteger) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlInteger}
- */
- public static XmlInteger newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlInteger) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlInteger} value
- */
- public static XmlInteger newValue(Object obj) {
- return (XmlInteger) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlInteger} fragment from a String. For example: "<code><xml-fragment>1234567890</xml-fragment></code>".
- */
- public static XmlInteger parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlInteger) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlInteger} fragment from a String. For example: "<code><xml-fragment>1234567890</xml-fragment></code>".
- */
- public static XmlInteger parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlInteger) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlInteger} fragment from a File.
- */
- public static XmlInteger parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlInteger) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlInteger} fragment from a File.
- */
- public static XmlInteger parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlInteger) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlInteger} fragment from a URL.
- */
- public static XmlInteger parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlInteger) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlInteger} fragment from a URL.
- */
- public static XmlInteger parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlInteger) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlInteger} fragment from an InputStream.
- */
- public static XmlInteger parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlInteger) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlInteger} fragment from an InputStream.
- */
- public static XmlInteger parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlInteger) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlInteger} fragment from a Reader.
- */
- public static XmlInteger parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlInteger) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlInteger} fragment from a Reader.
- */
- public static XmlInteger parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlInteger) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlInteger} fragment from a DOM Node.
- */
- public static XmlInteger parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlInteger) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlInteger} fragment from a DOM Node.
- */
- public static XmlInteger parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlInteger) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlInteger} fragment from an XMLStreamReader.
- */
- public static XmlInteger parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlInteger) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlInteger} fragment from an XMLStreamReader.
- */
- public static XmlInteger parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlInteger) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlLanguage.java b/src/main/java/org/apache/xmlbeans/XmlLanguage.java
index b936311..1a4bb71 100644
--- a/src/main/java/org/apache/xmlbeans/XmlLanguage.java
+++ b/src/main/java/org/apache/xmlbeans/XmlLanguage.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#language">xs:language</a> type.
@@ -24,138 +26,11 @@
* Convertible to a Java {@link String}.
*/
public interface XmlLanguage extends XmlToken {
+ XmlObjectFactory<XmlLanguage> Factory = new XmlObjectFactory<>("_BI_language");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_language");
-
- /**
- * A class with methods for creating instances
- * of {@link XmlLanguage}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlLanguage}
- */
- public static XmlLanguage newInstance() {
- return (XmlLanguage) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlLanguage}
- */
- public static XmlLanguage newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlLanguage) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlLanguage} value
- */
- public static XmlLanguage newValue(Object obj) {
- return (XmlLanguage) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlLanguage} fragment from a String. For example: "<code><xml-fragment>en-us</xml-fragment></code>".
- */
- public static XmlLanguage parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlLanguage) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlLanguage} fragment from a String. For example: "<code><xml-fragment>en-us</xml-fragment></code>".
- */
- public static XmlLanguage parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlLanguage) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlLanguage} fragment from a File.
- */
- public static XmlLanguage parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlLanguage) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlLanguage} fragment from a File.
- */
- public static XmlLanguage parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlLanguage) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlLanguage} fragment from a URL.
- */
- public static XmlLanguage parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlLanguage) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlLanguage} fragment from a URL.
- */
- public static XmlLanguage parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlLanguage) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlLanguage} fragment from an InputStream.
- */
- public static XmlLanguage parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlLanguage) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlLanguage} fragment from an InputStream.
- */
- public static XmlLanguage parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlLanguage) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlLanguage} fragment from a Reader.
- */
- public static XmlLanguage parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlLanguage) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlLanguage} fragment from a Reader.
- */
- public static XmlLanguage parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlLanguage) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlLanguage} fragment from a DOM Node.
- */
- public static XmlLanguage parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlLanguage) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlLanguage} fragment from a DOM Node.
- */
- public static XmlLanguage parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlLanguage) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlLanguage} fragment from an XMLStreamReader.
- */
- public static XmlLanguage parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlLanguage) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlLanguage} fragment from an XMLStreamReader.
- */
- public static XmlLanguage parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlLanguage) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
+ SchemaType type = Factory.getType();
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlLong.java b/src/main/java/org/apache/xmlbeans/XmlLong.java
index 0a9bce8..b8e5d89 100644
--- a/src/main/java/org/apache/xmlbeans/XmlLong.java
+++ b/src/main/java/org/apache/xmlbeans/XmlLong.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#long">xs:long</a> type.
@@ -23,10 +25,12 @@
* Naturally, convertible to a Java long.
*/
public interface XmlLong extends XmlInteger {
+ XmlObjectFactory<XmlLong> Factory = new XmlObjectFactory<>("_BI_long");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_long");
+ SchemaType type = Factory.getType();
/**
* Returns this value as a long
@@ -37,134 +41,5 @@
* Sets this value as a long
*/
void setLongValue(long v);
-
- /**
- * A class with methods for creating instances
- * of {@link XmlLong}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlLong}
- */
- public static XmlLong newInstance() {
- return (XmlLong) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlLong}
- */
- public static XmlLong newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlLong) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlLong} value
- */
- public static XmlLong newValue(Object obj) {
- return (XmlLong) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlLong} fragment from a String. For example: "<code><xml-fragment>123456789</xml-fragment></code>".
- */
- public static XmlLong parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlLong) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlLong} fragment from a String. For example: "<code><xml-fragment>123456789</xml-fragment></code>".
- */
- public static XmlLong parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlLong) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlLong} fragment from a File.
- */
- public static XmlLong parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlLong) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlLong} fragment from a File.
- */
- public static XmlLong parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlLong) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlLong} fragment from a URL.
- */
- public static XmlLong parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlLong) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlLong} fragment from a URL.
- */
- public static XmlLong parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlLong) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlLong} fragment from an InputStream.
- */
- public static XmlLong parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlLong) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlLong} fragment from an InputStream.
- */
- public static XmlLong parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlLong) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlLong} fragment from a Reader.
- */
- public static XmlLong parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlLong) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlLong} fragment from a Reader.
- */
- public static XmlLong parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlLong) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlLong} fragment from a DOM Node.
- */
- public static XmlLong parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlLong) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlLong} fragment from a DOM Node.
- */
- public static XmlLong parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlLong) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlLong} fragment from an XMLStreamReader.
- */
- public static XmlLong parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlLong) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlLong} fragment from an XMLStreamReader.
- */
- public static XmlLong parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlLong) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlNCName.java b/src/main/java/org/apache/xmlbeans/XmlNCName.java
index 4f52fca..7894e7b 100644
--- a/src/main/java/org/apache/xmlbeans/XmlNCName.java
+++ b/src/main/java/org/apache/xmlbeans/XmlNCName.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#Name">xs:Name</a> type.
@@ -28,138 +30,11 @@
* Convertible to {@link String}.
*/
public interface XmlNCName extends XmlName {
+ XmlObjectFactory<XmlNCName> Factory = new XmlObjectFactory<>("_BI_NCName");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_NCName");
-
- /**
- * A class with methods for creating instances
- * of {@link XmlNCName}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlNCName}
- */
- public static XmlNCName newInstance() {
- return (XmlNCName) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlNCName}
- */
- public static XmlNCName newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlNCName) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlNCName} value
- */
- public static XmlNCName newValue(Object obj) {
- return (XmlNCName) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlNCName} fragment from a String. For example: "<code><xml-fragment>My-Name</xml-fragment></code>".
- */
- public static XmlNCName parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlNCName) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlNCName} fragment from a String. For example: "<code><xml-fragment>My-Name</xml-fragment></code>".
- */
- public static XmlNCName parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlNCName) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlNCName} fragment from a File.
- */
- public static XmlNCName parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNCName) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlNCName} fragment from a File.
- */
- public static XmlNCName parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNCName) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlNCName} fragment from a URL.
- */
- public static XmlNCName parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNCName) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlNCName} fragment from a URL.
- */
- public static XmlNCName parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNCName) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlNCName} fragment from an InputStream.
- */
- public static XmlNCName parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNCName) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlNCName} fragment from an InputStream.
- */
- public static XmlNCName parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNCName) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlNCName} fragment from a Reader.
- */
- public static XmlNCName parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNCName) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlNCName} fragment from a Reader.
- */
- public static XmlNCName parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNCName) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlNCName} fragment from a DOM Node.
- */
- public static XmlNCName parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlNCName) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlNCName} fragment from a DOM Node.
- */
- public static XmlNCName parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlNCName) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlNCName} fragment from an XMLStreamReader.
- */
- public static XmlNCName parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlNCName) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlNCName} fragment from an XMLStreamReader.
- */
- public static XmlNCName parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlNCName) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
+ SchemaType type = Factory.getType();
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlNMTOKEN.java b/src/main/java/org/apache/xmlbeans/XmlNMTOKEN.java
index dfccff4..712bfae 100644
--- a/src/main/java/org/apache/xmlbeans/XmlNMTOKEN.java
+++ b/src/main/java/org/apache/xmlbeans/XmlNMTOKEN.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#NMTOKEN">xs:NMTOKEN</a> type.
@@ -27,138 +29,11 @@
* Convertible to {@link String}.
*/
public interface XmlNMTOKEN extends XmlToken {
+ XmlObjectFactory<XmlNMTOKEN> Factory = new XmlObjectFactory<>("_BI_NMTOKEN");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_NMTOKEN");
-
- /**
- * A class with methods for creating instances
- * of {@link XmlNMTOKEN}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlNMTOKEN}
- */
- public static XmlNMTOKEN newInstance() {
- return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlNMTOKEN}
- */
- public static XmlNMTOKEN newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlNMTOKEN} value
- */
- public static XmlNMTOKEN newValue(Object obj) {
- return (XmlNMTOKEN) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlNMTOKEN} fragment from a String. For example: "<code><xml-fragment>sample-1.2</xml-fragment></code>".
- */
- public static XmlNMTOKEN parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlNMTOKEN} fragment from a String. For example: "<code><xml-fragment>sample-1.2</xml-fragment></code>".
- */
- public static XmlNMTOKEN parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlNMTOKEN} fragment from a File.
- */
- public static XmlNMTOKEN parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlNMTOKEN} fragment from a File.
- */
- public static XmlNMTOKEN parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlNMTOKEN} fragment from a URL.
- */
- public static XmlNMTOKEN parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlNMTOKEN} fragment from a URL.
- */
- public static XmlNMTOKEN parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlNMTOKEN} fragment from an InputStream.
- */
- public static XmlNMTOKEN parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlNMTOKEN} fragment from an InputStream.
- */
- public static XmlNMTOKEN parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlNMTOKEN} fragment from a Reader.
- */
- public static XmlNMTOKEN parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlNMTOKEN} fragment from a Reader.
- */
- public static XmlNMTOKEN parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlNMTOKEN} fragment from a DOM Node.
- */
- public static XmlNMTOKEN parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlNMTOKEN} fragment from a DOM Node.
- */
- public static XmlNMTOKEN parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlNMTOKEN} fragment from an XMLStreamReader.
- */
- public static XmlNMTOKEN parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlNMTOKEN} fragment from an XMLStreamReader.
- */
- public static XmlNMTOKEN parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
+ SchemaType type = Factory.getType();
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlNMTOKENS.java b/src/main/java/org/apache/xmlbeans/XmlNMTOKENS.java
index 9cf6fbb..df8d746 100644
--- a/src/main/java/org/apache/xmlbeans/XmlNMTOKENS.java
+++ b/src/main/java/org/apache/xmlbeans/XmlNMTOKENS.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
import java.util.List;
@@ -26,10 +28,12 @@
* Convertible to {@link List}.
*/
public interface XmlNMTOKENS extends XmlAnySimpleType {
+ XmlObjectFactory<XmlNMTOKENS> Factory = new XmlObjectFactory<>("_BI_NMTOKENS");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_NMTOKENS");
+ SchemaType type = Factory.getType();
/**
* Returns the value as a {@link List} of {@link String} values
@@ -45,134 +49,5 @@
* Sets the value as a {@link List}
*/
void setListValue(List<?> l);
-
- /**
- * A class with methods for creating instances
- * of {@link XmlNMTOKENS}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlNMTOKENS}
- */
- public static XmlNMTOKENS newInstance() {
- return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlNMTOKENS}
- */
- public static XmlNMTOKENS newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlNMTOKENS} value
- */
- public static XmlNMTOKENS newValue(Object obj) {
- return (XmlNMTOKENS) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlNMTOKENS} fragment from a String. For example: "<code><xml-fragment>sample-1.1 sample-1.2 sample-1.3</xml-fragment></code>".
- */
- public static XmlNMTOKENS parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlNMTOKENS} fragment from a String. For example: "<code><xml-fragment>sample-1.1 sample-1.2 sample-1.3</xml-fragment></code>".
- */
- public static XmlNMTOKENS parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlNMTOKENS} fragment from a File.
- */
- public static XmlNMTOKENS parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlNMTOKENS} fragment from a File.
- */
- public static XmlNMTOKENS parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlNMTOKENS} fragment from a URL.
- */
- public static XmlNMTOKENS parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlNMTOKENS} fragment from a URL.
- */
- public static XmlNMTOKENS parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlNMTOKENS} fragment from an InputStream.
- */
- public static XmlNMTOKENS parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlNMTOKENS} fragment from an InputStream.
- */
- public static XmlNMTOKENS parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlNMTOKENS} fragment from a Reader.
- */
- public static XmlNMTOKENS parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlNMTOKENS} fragment from a Reader.
- */
- public static XmlNMTOKENS parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlNMTOKENS} fragment from a DOM Node.
- */
- public static XmlNMTOKENS parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlNMTOKENS} fragment from a DOM Node.
- */
- public static XmlNMTOKENS parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlNMTOKENS} fragment from an XMLStreamReader.
- */
- public static XmlNMTOKENS parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlNMTOKENS} fragment from an XMLStreamReader.
- */
- public static XmlNMTOKENS parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlNOTATION.java b/src/main/java/org/apache/xmlbeans/XmlNOTATION.java
index 6b56eaa..bd6132d 100644
--- a/src/main/java/org/apache/xmlbeans/XmlNOTATION.java
+++ b/src/main/java/org/apache/xmlbeans/XmlNOTATION.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#NOTATION">xs:NOTATION</a> type.
@@ -26,138 +28,11 @@
* Convertible to {@link String}.
*/
public interface XmlNOTATION extends XmlAnySimpleType {
+ XmlObjectFactory<XmlNOTATION> Factory = new XmlObjectFactory<>("_BI_NOTATION");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_NOTATION");
-
- /**
- * A class with methods for creating instances
- * of {@link XmlNOTATION}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlNOTATION}
- */
- public static XmlNOTATION newInstance() {
- return (XmlNOTATION) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlNOTATION}
- */
- public static XmlNOTATION newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlNOTATION) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlNOTATION} value
- */
- public static XmlNOTATION newValue(Object obj) {
- return (XmlNOTATION) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlNOTATION} fragment from a String.
- */
- public static XmlNOTATION parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlNOTATION} fragment from a String.
- */
- public static XmlNOTATION parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlNOTATION} fragment from a File.
- */
- public static XmlNOTATION parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlNOTATION} fragment from a File.
- */
- public static XmlNOTATION parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlNOTATION} fragment from a URL.
- */
- public static XmlNOTATION parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlNOTATION} fragment from a URL.
- */
- public static XmlNOTATION parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlNOTATION} fragment from an InputStream.
- */
- public static XmlNOTATION parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlNOTATION} fragment from an InputStream.
- */
- public static XmlNOTATION parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlNOTATION} fragment from a Reader.
- */
- public static XmlNOTATION parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlNOTATION} fragment from a Reader.
- */
- public static XmlNOTATION parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlNOTATION} fragment from a DOM Node.
- */
- public static XmlNOTATION parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlNOTATION} fragment from a DOM Node.
- */
- public static XmlNOTATION parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlNOTATION} fragment from an XMLStreamReader.
- */
- public static XmlNOTATION parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlNOTATION} fragment from an XMLStreamReader.
- */
- public static XmlNOTATION parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
+ SchemaType type = Factory.getType();
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlName.java b/src/main/java/org/apache/xmlbeans/XmlName.java
index 1bd945d..b0c5ea2 100644
--- a/src/main/java/org/apache/xmlbeans/XmlName.java
+++ b/src/main/java/org/apache/xmlbeans/XmlName.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#Name">xs:Name</a> type.
@@ -28,138 +30,11 @@
* Convertible to {@link String}.
*/
public interface XmlName extends XmlToken {
+ XmlObjectFactory<XmlName> Factory = new XmlObjectFactory<>("_BI_Name");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_Name");
-
- /**
- * A class with methods for creating instances
- * of {@link XmlName}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlName}
- */
- public static XmlName newInstance() {
- return (XmlName) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlName}
- */
- public static XmlName newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlName) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlName} value
- */
- public static XmlName newValue(Object obj) {
- return (XmlName) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlName} fragment from a String. For example: "<code><xml-fragment>My:Name</xml-fragment></code>".
- */
- public static XmlName parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlName) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlName} fragment from a String. For example: "<code><xml-fragment>My:Name</xml-fragment></code>".
- */
- public static XmlName parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlName) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlName} fragment from a File.
- */
- public static XmlName parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlName) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlName} fragment from a File.
- */
- public static XmlName parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlName) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlName} fragment from a URL.
- */
- public static XmlName parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlName) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlName} fragment from a URL.
- */
- public static XmlName parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlName) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlName} fragment from an InputStream.
- */
- public static XmlName parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlName) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlName} fragment from an InputStream.
- */
- public static XmlName parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlName) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlName} fragment from a Reader.
- */
- public static XmlName parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlName) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlName} fragment from a Reader.
- */
- public static XmlName parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlName) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlName} fragment from a DOM Node.
- */
- public static XmlName parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlName) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlName} fragment from a DOM Node.
- */
- public static XmlName parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlName) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlName} fragment from an XMLStreamReader.
- */
- public static XmlName parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlName) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlName} fragment from an XMLStreamReader.
- */
- public static XmlName parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlName) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
+ SchemaType type = Factory.getType();
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlNegativeInteger.java b/src/main/java/org/apache/xmlbeans/XmlNegativeInteger.java
index ee7aa7c..21af253 100644
--- a/src/main/java/org/apache/xmlbeans/XmlNegativeInteger.java
+++ b/src/main/java/org/apache/xmlbeans/XmlNegativeInteger.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#negativeInteger">xs:negativeInteger</a> type.
@@ -25,138 +27,11 @@
* Convertible to {@link java.math.BigInteger}.
*/
public interface XmlNegativeInteger extends XmlNonPositiveInteger {
+ XmlObjectFactory<XmlNegativeInteger> Factory = new XmlObjectFactory<>("_BI_negativeInteger");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_negativeInteger");
-
- /**
- * A class with methods for creating instances
- * of {@link XmlNegativeInteger}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlNegativeInteger}
- */
- public static XmlNegativeInteger newInstance() {
- return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlNegativeInteger}
- */
- public static XmlNegativeInteger newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlNegativeInteger} value
- */
- public static XmlNegativeInteger newValue(Object obj) {
- return (XmlNegativeInteger) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlNegativeInteger} fragment from a String. For example: "<code><xml-fragment>-1234567890</xml-fragment></code>".
- */
- public static XmlNegativeInteger parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlNegativeInteger} fragment from a String. For example: "<code><xml-fragment>-1234567890</xml-fragment></code>".
- */
- public static XmlNegativeInteger parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlNegativeInteger} fragment from a File.
- */
- public static XmlNegativeInteger parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlNegativeInteger} fragment from a File.
- */
- public static XmlNegativeInteger parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlNegativeInteger} fragment from a URL.
- */
- public static XmlNegativeInteger parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlNegativeInteger} fragment from a URL.
- */
- public static XmlNegativeInteger parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlNegativeInteger} fragment from an InputStream.
- */
- public static XmlNegativeInteger parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlNegativeInteger} fragment from an InputStream.
- */
- public static XmlNegativeInteger parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlNegativeInteger} fragment from a Reader.
- */
- public static XmlNegativeInteger parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlNegativeInteger} fragment from a Reader.
- */
- public static XmlNegativeInteger parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlNegativeInteger} fragment from a DOM Node.
- */
- public static XmlNegativeInteger parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlNegativeInteger} fragment from a DOM Node.
- */
- public static XmlNegativeInteger parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlNegativeInteger} fragment from an XMLStreamReader.
- */
- public static XmlNegativeInteger parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlNegativeInteger} fragment from an XMLStreamReader.
- */
- public static XmlNegativeInteger parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
+ SchemaType type = Factory.getType();
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlNonNegativeInteger.java b/src/main/java/org/apache/xmlbeans/XmlNonNegativeInteger.java
index 0179f4e..8d5de22 100644
--- a/src/main/java/org/apache/xmlbeans/XmlNonNegativeInteger.java
+++ b/src/main/java/org/apache/xmlbeans/XmlNonNegativeInteger.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#nonNegativeInteger">xs:nonNegativeInteger</a> type.
@@ -25,138 +27,11 @@
* Convertible to {@link java.math.BigInteger}.
*/
public interface XmlNonNegativeInteger extends XmlInteger {
+ XmlObjectFactory<XmlNonNegativeInteger> Factory = new XmlObjectFactory<>("_BI_nonNegativeInteger");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_nonNegativeInteger");
-
- /**
- * A class with methods for creating instances
- * of {@link XmlNonNegativeInteger}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlNonNegativeInteger}
- */
- public static XmlNonNegativeInteger newInstance() {
- return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlNonNegativeInteger}
- */
- public static XmlNonNegativeInteger newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlNonNegativeInteger} value
- */
- public static XmlNonNegativeInteger newValue(Object obj) {
- return (XmlNonNegativeInteger) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlNonNegativeInteger} fragment from a String. For example: "<code><xml-fragment>1234567890</xml-fragment></code>".
- */
- public static XmlNonNegativeInteger parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlNonNegativeInteger} fragment from a String. For example: "<code><xml-fragment>1234567890</xml-fragment></code>".
- */
- public static XmlNonNegativeInteger parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlNonNegativeInteger} fragment from a File.
- */
- public static XmlNonNegativeInteger parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlNonNegativeInteger} fragment from a File.
- */
- public static XmlNonNegativeInteger parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlNonNegativeInteger} fragment from a URL.
- */
- public static XmlNonNegativeInteger parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlNonNegativeInteger} fragment from a URL.
- */
- public static XmlNonNegativeInteger parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlNonNegativeInteger} fragment from an InputStream.
- */
- public static XmlNonNegativeInteger parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlNonNegativeInteger} fragment from an InputStream.
- */
- public static XmlNonNegativeInteger parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlNonNegativeInteger} fragment from a Reader.
- */
- public static XmlNonNegativeInteger parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlNonNegativeInteger} fragment from a Reader.
- */
- public static XmlNonNegativeInteger parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlNonNegativeInteger} fragment from a DOM Node.
- */
- public static XmlNonNegativeInteger parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlNonNegativeInteger} fragment from a DOM Node.
- */
- public static XmlNonNegativeInteger parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlNonNegativeInteger} fragment from an XMLStreamReader.
- */
- public static XmlNonNegativeInteger parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlNonNegativeInteger} fragment from an XMLStreamReader.
- */
- public static XmlNonNegativeInteger parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
+ SchemaType type = Factory.getType();
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlNonPositiveInteger.java b/src/main/java/org/apache/xmlbeans/XmlNonPositiveInteger.java
index 6333e88..d17997a 100644
--- a/src/main/java/org/apache/xmlbeans/XmlNonPositiveInteger.java
+++ b/src/main/java/org/apache/xmlbeans/XmlNonPositiveInteger.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#nonPositiveInteger">xs:nonPositiveInteger</a> type.
@@ -25,138 +27,11 @@
* Convertible to {@link java.math.BigInteger}.
*/
public interface XmlNonPositiveInteger extends XmlInteger {
+ XmlObjectFactory<XmlNonPositiveInteger> Factory = new XmlObjectFactory<>("_BI_nonPositiveInteger");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_nonPositiveInteger");
-
- /**
- * A class with methods for creating instances
- * of {@link XmlNonPositiveInteger}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlNonPositiveInteger}
- */
- public static XmlNonPositiveInteger newInstance() {
- return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlNonPositiveInteger}
- */
- public static XmlNonPositiveInteger newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlNonPositiveInteger} value
- */
- public static XmlNonPositiveInteger newValue(Object obj) {
- return (XmlNonPositiveInteger) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlNonPositiveInteger} fragment from a String. For example: "<code><xml-fragment>-1234567890</xml-fragment></code>".
- */
- public static XmlNonPositiveInteger parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlNonPositiveInteger} fragment from a String. For example: "<code><xml-fragment>-1234567890</xml-fragment></code>".
- */
- public static XmlNonPositiveInteger parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlNonPositiveInteger} fragment from a File.
- */
- public static XmlNonPositiveInteger parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlNonPositiveInteger} fragment from a File.
- */
- public static XmlNonPositiveInteger parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlNonPositiveInteger} fragment from a URL.
- */
- public static XmlNonPositiveInteger parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlNonPositiveInteger} fragment from a URL.
- */
- public static XmlNonPositiveInteger parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlNonPositiveInteger} fragment from an InputStream.
- */
- public static XmlNonPositiveInteger parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlNonPositiveInteger} fragment from an InputStream.
- */
- public static XmlNonPositiveInteger parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlNonPositiveInteger} fragment from a Reader.
- */
- public static XmlNonPositiveInteger parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlNonPositiveInteger} fragment from a Reader.
- */
- public static XmlNonPositiveInteger parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlNonPositiveInteger} fragment from a DOM Node.
- */
- public static XmlNonPositiveInteger parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlNonPositiveInteger} fragment from a DOM Node.
- */
- public static XmlNonPositiveInteger parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlNonPositiveInteger} fragment from an XMLStreamReader.
- */
- public static XmlNonPositiveInteger parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlNonPositiveInteger} fragment from an XMLStreamReader.
- */
- public static XmlNonPositiveInteger parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
+ SchemaType type = Factory.getType();
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlNormalizedString.java b/src/main/java/org/apache/xmlbeans/XmlNormalizedString.java
index 98fe1c5..fd223cc 100644
--- a/src/main/java/org/apache/xmlbeans/XmlNormalizedString.java
+++ b/src/main/java/org/apache/xmlbeans/XmlNormalizedString.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#normalizedString">xs:normalizedString</a> type.
@@ -32,138 +34,11 @@
* whitespace-normalized value is returned.
*/
public interface XmlNormalizedString extends XmlString {
+ XmlObjectFactory<XmlNormalizedString> Factory = new XmlObjectFactory<>("_BI_normalizedString");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_normalizedString");
-
- /**
- * A class with methods for creating instances
- * of {@link XmlNormalizedString}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlNormalizedString}
- */
- public static XmlNormalizedString newInstance() {
- return (XmlNormalizedString) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlNormalizedString}
- */
- public static XmlNormalizedString newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlNormalizedString) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlNormalizedString} value
- */
- public static XmlNormalizedString newValue(Object obj) {
- return (XmlNormalizedString) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlNormalizedString} fragment from a String. For example: "<code><xml-fragment> string to normalize </xml-fragment></code>".
- */
- public static XmlNormalizedString parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlNormalizedString} fragment from a String. For example: "<code><xml-fragment> string to normalize </xml-fragment></code>".
- */
- public static XmlNormalizedString parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlNormalizedString} fragment from a File.
- */
- public static XmlNormalizedString parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlNormalizedString} fragment from a File.
- */
- public static XmlNormalizedString parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlNormalizedString} fragment from a URL.
- */
- public static XmlNormalizedString parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlNormalizedString} fragment from a URL.
- */
- public static XmlNormalizedString parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlNormalizedString} fragment from an InputStream.
- */
- public static XmlNormalizedString parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlNormalizedString} fragment from an InputStream.
- */
- public static XmlNormalizedString parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlNormalizedString} fragment from a Reader.
- */
- public static XmlNormalizedString parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlNormalizedString} fragment from a Reader.
- */
- public static XmlNormalizedString parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlNormalizedString} fragment from a DOM Node.
- */
- public static XmlNormalizedString parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlNormalizedString} fragment from a DOM Node.
- */
- public static XmlNormalizedString parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlNormalizedString} fragment from an XMLStreamReader.
- */
- public static XmlNormalizedString parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlNormalizedString} fragment from an XMLStreamReader.
- */
- public static XmlNormalizedString parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
+ SchemaType type = Factory.getType();
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlObject.java b/src/main/java/org/apache/xmlbeans/XmlObject.java
index d99f151..97bbeaf 100644
--- a/src/main/java/org/apache/xmlbeans/XmlObject.java
+++ b/src/main/java/org/apache/xmlbeans/XmlObject.java
@@ -15,15 +15,10 @@
package org.apache.xmlbeans;
-import org.w3c.dom.DOMImplementation;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
import org.w3c.dom.Node;
import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
/**
* Corresponds to the XML Schema
@@ -40,7 +35,7 @@
* <p>
* <ul>
* <li>Every XML Bean class has an inner Factory class for creating and parsing
- * instances, including XmlObject. Use {@link XmlObject.Factory} itself
+ * instances, including XmlObject. Use {@link XmlObjectFactory} itself
* to produce untyped XML trees or XML trees that implement specific
* subtypes of XmlObject depending on a recognized root document element.
* If you depend on the automatic type inference, you will want to understand
@@ -53,8 +48,8 @@
* an XML document, you will want to understand the inner contents
* versus outer container issues described below.
* <li>It is also simple to copy an XmlObject instance to or from a standard
- * DOM tree or SAX stream. Use {@link XmlObject.Factory#parse(Node)},
- * for example, to load from DOM; use {@link XmlObject.Factory#newXmlSaxHandler}
+ * DOM tree or SAX stream. Use {@link XmlObjectFactory#parse(Node)},
+ * for example, to load from DOM; use {@link XmlObjectFactory#newXmlSaxHandler}
* to load from SAX; use {@link #newDomNode()} to save to DOM; and use
* {@link #save(org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler)}
* to save to SAX.
@@ -72,7 +67,7 @@
* the current element or attribute.)
* </ul>
* <p>
- * Type inference. When using {@link XmlObject.Factory} to parse XML documents,
+ * Type inference. When using {@link XmlObjectFactory} to parse XML documents,
* the actual document type is not {@link XmlObject#type} itself, but a subtype
* based on the contents of the parsed document. If the parsed document
* contains a recognized root document element, then the actual type of the
@@ -113,7 +108,7 @@
* which is saved by default.
* <p>
* Reading and writing fragments. When reading or writing the contents of a
- * whole XML document, the standard XML reprentation for a document is used.
+ * whole XML document, the standard XML representation for a document is used.
* However, there is no standard concrete XML representation for "just the
* contents" of an interior element or attribute. So when one is needed,
* the tag <xml-fragment> is used to wrap the contents. This tag is used
@@ -130,10 +125,12 @@
* with future versions of XMLBeans that add additional methods on XmlObject.
*/
public interface XmlObject extends XmlTokenSource {
+ XmlObjectFactory<XmlObject> Factory = new XmlObjectFactory<>("_BI_anyType");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_anyType");
+ SchemaType type = Factory.getType();
/**
* @return The schema type for this instance. This is a permanent,
@@ -148,7 +145,7 @@
* tree.
*
* @return true if the contents of this object are valid
- * accoring to schemaType().
+ * according to schemaType().
*/
boolean validate();
@@ -187,7 +184,7 @@
* @param options An object that implements the {@link java.util.Collection
* Collection} interface.
* @return true if the contents of this object are valid
- * accoring to schemaType().
+ * according to schemaType().
*/
boolean validate(XmlOptions options);
@@ -196,7 +193,7 @@
* <p>
* <p>
* The path must be a relative path, where "." represents the
- * element or attribute containg this XmlObject, and it must select
+ * element or attribute containing this XmlObject, and it must select
* only other elements or attributes. If a non-element or non-attribute
* is selected, an unchecked exception is thrown.
* <p>
@@ -364,7 +361,7 @@
* In order for the operation to succeed, several conditions must hold:
* <ul><li> the container of this type must be an element </li>
* <li> a global element with the name <code>newName</code> must exist
- * and must be in the substition group of the containing element </li>
+ * and must be in the substitution group of the containing element </li>
* <li> the <code>newType</code> type must be consistent with the declared
* type of the new element </li></ul>
* <p>
@@ -440,7 +437,7 @@
* not copied.
* <p>
* Note: The result object will be in the same synchronization domain as the source,
- * and additional synchronization is required for concurent access.
+ * and additional synchronization is required for concurrent access.
* To use a different synchronization domain use setCopyUseNewSynchronizationDomain
* option with copy(XmlOptions) method.
*
@@ -457,7 +454,7 @@
* not copied.
* <p>
* Note: The result object will be in the same synchronization domain as the source,
- * and additional synchronization is required for concurent access.
+ * and additional synchronization is required for concurrent access.
* To use a different synchronization domain use setCopyUseNewSynchronizationDomain
* option when creating the original XmlObject.
*
@@ -470,7 +467,7 @@
* (which are distinguished by equals(obj) == false) may of
* course have equal values (valueEquals(obj) == true).
* <p>
- * Usually this method can be treated as an ordinary equvalence
+ * Usually this method can be treated as an ordinary equivalence
* relation, but actually it is not is not transitive.
* Here is a precise specification:
* <p>
@@ -501,7 +498,7 @@
int valueHashCode();
/**
- * Impelements the Comparable interface by comparing two simple
+ * Implements the Comparable interface by comparing two simple
* xml values based on their standard XML schema ordering.
* Throws a ClassCastException if no standard ordering applies,
* or if the two values are incomparable within a partial order.
@@ -520,22 +517,22 @@
/**
* LESS_THAN is -1. See {@link #compareValue}.
*/
- static final int LESS_THAN = -1;
+ int LESS_THAN = -1;
/**
* EQUAL is 0. See {@link #compareValue}.
*/
- static final int EQUAL = 0;
+ int EQUAL = 0;
/**
* GREATER_THAN is 1. See {@link #compareValue}.
*/
- static final int GREATER_THAN = 1;
+ int GREATER_THAN = 1;
/**
* NOT_EQUAL is 2. See {@link #compareValue}.
*/
- static final int NOT_EQUAL = 2;
+ int NOT_EQUAL = 2;
/**
* Selects the contents of the children elements with the given name.
@@ -590,283 +587,4 @@
* @see QNameSetBuilder for creating sets of qnames
*/
XmlObject[] selectAttributes(QNameSet attributeNameSet);
-
- /**
- * Static factory class for creating new instances. Note that if
- * a type can be inferred from the XML being loaded (for example,
- * by recognizing the document element QName), then the instance
- * returned by a factory will have the inferred type. Otherwise
- * the Factory will returned an untyped document.
- */
- final class Factory {
- /**
- * Creates a new, completely empty instance.
- */
- public static XmlObject newInstance() {
- return XmlBeans.getContextTypeLoader().newInstance(null, null);
- }
-
- /**
- * <p>Creates a new, completely empty instance, specifying options
- * for the root element's document type and/or whether to validate
- * value facets as they are set.</p>
- * <p>
- * Use the <em>options</em> parameter to specify the following:</p>
- *
- * <table>
- * <tr><th>To specify this</th><th>Use this method</th></tr>
- * <tr>
- * <td>The document type for the root element.</td>
- * <td>{@link XmlOptions#setDocumentType}</td>
- * </tr>
- * <tr>
- * <td>Whether value facets should be checked as they are set.</td>
- * <td>{@link XmlOptions#setValidateOnSet}</td>
- * </tr>
- * </table>
- *
- * @param options Options specifying root document type and/or value facet
- * checking.
- * @return A new, empty instance of XmlObject.</li>
- */
- public static XmlObject newInstance(XmlOptions options) {
- return XmlBeans.getContextTypeLoader().newInstance(null, options);
- }
-
- /**
- * Creates a new immutable value.
- */
- /**
- * Creates an immutable {@link XmlObject} value
- */
- public static XmlObject newValue(Object obj) {
- return type.newValue(obj);
- }
-
- /**
- * Parses the given {@link String} as XML.
- */
- public static XmlObject parse(String xmlAsString) throws XmlException {
- return XmlBeans.getContextTypeLoader().parse(xmlAsString, null, null);
- }
-
- /**
- * Parses the given {@link String} as XML.
- * <p>
- * Use the <em>options</em> parameter to specify the following:</p>
- *
- * <table>
- * <tr><th>To specify this</th><th>Use this method</th></tr>
- * <tr>
- * <td>The document type for the root element.</td>
- * <td>{@link XmlOptions#setDocumentType}</td>
- * </tr>
- * <tr>
- * <td>To place line number annotations in the store when parsing a document.</td>
- * <td>{@link XmlOptions#setLoadLineNumbers}</td>
- * </tr>
- * <tr>
- * <td>To replace the document element with the specified QName when parsing.</td>
- * <td>{@link XmlOptions#setLoadReplaceDocumentElement}</td>
- * </tr>
- * <tr>
- * <td>To strip all insignificant whitespace when parsing a document.</td>
- * <td>{@link XmlOptions#setLoadStripWhitespace}</td>
- * </tr>
- * <tr>
- * <td>To strip all comments when parsing a document.</td>
- * <td>{@link XmlOptions#setLoadStripComments}</td>
- * </tr>
- * <tr>
- * <td>To strip all processing instructions when parsing a document.</td>
- * <td>{@link XmlOptions#setLoadStripProcinsts}</td>
- * </tr>
- * <tr>
- * <td>A map of namespace URI substitutions to use when parsing a document.</td>
- * <td>{@link XmlOptions#setLoadSubstituteNamespaces}</td>
- * </tr>
- * <tr>
- * <td>Additional namespace mappings to be added when parsing a document.</td>
- * <td>{@link XmlOptions#setLoadAdditionalNamespaces}</td>
- * </tr>
- * <tr>
- * <td>To trim the underlying XML text buffer immediately after parsing
- * a document, resulting in a smaller memory footprint.</td>
- * <td>{@link XmlOptions#setLoadTrimTextBuffer}</td>
- * </tr>
- * </table>
- *
- * @param xmlAsString The string to parse.
- * @param options Options as specified.
- * @return A new instance containing the specified XML.
- */
- public static XmlObject parse(String xmlAsString, XmlOptions options) throws XmlException {
- return XmlBeans.getContextTypeLoader().parse(xmlAsString, null, options);
- }
-
- /**
- * Parses the given {@link File} as XML.
- */
- public static XmlObject parse(File file) throws XmlException, IOException {
- return XmlBeans.getContextTypeLoader().parse(file, null, null);
- }
-
- /**
- * Parses the given {@link File} as XML.
- */
- public static XmlObject parse(File file, XmlOptions options) throws XmlException, IOException {
- return XmlBeans.getContextTypeLoader().parse(file, null, options);
- }
-
- /**
- * Downloads the given {@link java.net.URL} as XML.
- */
- public static XmlObject parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return XmlBeans.getContextTypeLoader().parse(u, null, null);
- }
-
- /**
- * Downloads the given {@link java.net.URL} as XML.
- */
- public static XmlObject parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return XmlBeans.getContextTypeLoader().parse(u, null, options);
- }
-
- /**
- * Decodes and parses the given {@link InputStream} as XML.
- */
- public static XmlObject parse(InputStream is) throws XmlException, IOException {
- return XmlBeans.getContextTypeLoader().parse(is, null, null);
- }
-
- /**
- * Decodes and parses the given {@link XMLStreamReader} as XML.
- */
- public static XmlObject parse(XMLStreamReader xsr) throws XmlException {
- return XmlBeans.getContextTypeLoader().parse(xsr, null, null);
- }
-
- /**
- * Decodes and parses the given {@link InputStream} as XML.
- * <p>
- * Use the <em>options</em> parameter to specify the following:</p>
- *
- * <table>
- * <tr><th>To specify this</th><th>Use this method</th></tr>
- * <tr>
- * <td>The character encoding to use when parsing or writing a document.</td>
- * <td>{@link XmlOptions#setCharacterEncoding}</td>
- * </tr>
- * <tr>
- * <td>The document type for the root element.</td>
- * <td>{@link XmlOptions#setDocumentType}</td>
- * </tr>
- * <tr>
- * <td>Place line number annotations in the store when parsing a document.</td>
- * <td>{@link XmlOptions#setLoadLineNumbers}</td>
- * </tr>
- * <tr>
- * <td>Replace the document element with the specified QName when parsing.</td>
- * <td>{@link XmlOptions#setLoadReplaceDocumentElement}</td>
- * </tr>
- * <tr>
- * <td>Strip all insignificant whitespace when parsing a document.</td>
- * <td>{@link XmlOptions#setLoadStripWhitespace}</td>
- * </tr>
- * <tr>
- * <td>Strip all comments when parsing a document.</td>
- * <td>{@link XmlOptions#setLoadStripComments}</td>
- * </tr>
- * <tr>
- * <td>Strip all processing instructions when parsing a document.</td>
- * <td>{@link XmlOptions#setLoadStripProcinsts}</td>
- * </tr>
- * <tr>
- * <td>Set a map of namespace URI substitutions to use when parsing a document.</td>
- * <td>{@link XmlOptions#setLoadSubstituteNamespaces}</td>
- * </tr>
- * <tr>
- * <td>Set additional namespace mappings to be added when parsing a document.</td>
- * <td>{@link XmlOptions#setLoadAdditionalNamespaces}</td>
- * </tr>
- * <tr>
- * <td>Trim the underlying XML text buffer immediately after parsing
- * a document, resulting in a smaller memory footprint.</td>
- * <td>{@link XmlOptions#setLoadTrimTextBuffer}</td>
- * </tr>
- * </table>
- */
- public static XmlObject parse(InputStream is, XmlOptions options) throws XmlException, IOException {
- return XmlBeans.getContextTypeLoader().parse(is, null, options);
- }
-
- /**
- * Parses the given {@link XMLStreamReader} as XML.
- */
- public static XmlObject parse(XMLStreamReader xsr, XmlOptions options) throws XmlException {
- return XmlBeans.getContextTypeLoader().parse(xsr, null, options);
- }
-
- /**
- * Parses the given {@link Reader} as XML.
- */
- public static XmlObject parse(Reader r) throws XmlException, IOException {
- return XmlBeans.getContextTypeLoader().parse(r, null, null);
- }
-
- /**
- * Parses the given {@link Reader} as XML.
- */
- public static XmlObject parse(Reader r, XmlOptions options) throws XmlException, IOException {
- return XmlBeans.getContextTypeLoader().parse(r, null, options);
- }
-
- /**
- * Converts the given DOM {@link Node} into an XmlObject.
- */
- public static XmlObject parse(Node node) throws XmlException {
- return XmlBeans.getContextTypeLoader().parse(node, null, null);
- }
-
- /**
- * Converts the given DOM {@link Node} into an XmlObject.
- */
- public static XmlObject parse(Node node, XmlOptions options) throws XmlException {
- return XmlBeans.getContextTypeLoader().parse(node, null, options);
- }
-
- /**
- * Returns an {@link XmlSaxHandler} that can load an XmlObject from SAX events.
- */
- public static XmlSaxHandler newXmlSaxHandler() {
- return XmlBeans.getContextTypeLoader().newXmlSaxHandler(null, null);
- }
-
- /**
- * Returns an {@link XmlSaxHandler} that can load an XmlObject from SAX events.
- */
- public static XmlSaxHandler newXmlSaxHandler(XmlOptions options) {
- return XmlBeans.getContextTypeLoader().newXmlSaxHandler(null, options);
- }
-
- /**
- * Creates a new DOMImplementation object
- */
- public static DOMImplementation newDomImplementation() {
- return XmlBeans.getContextTypeLoader().newDomImplementation(null);
- }
-
- /**
- * Creates a new DOMImplementation object, taking options
- */
- public static DOMImplementation newDomImplementation(XmlOptions options) {
- return XmlBeans.getContextTypeLoader().newDomImplementation(options);
- }
-
- /**
- * Instances cannot be created.
- */
- private Factory() {
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlOptions.java b/src/main/java/org/apache/xmlbeans/XmlOptions.java
index ff6b2e5..7fd8ed6 100644
--- a/src/main/java/org/apache/xmlbeans/XmlOptions.java
+++ b/src/main/java/org/apache/xmlbeans/XmlOptions.java
@@ -133,6 +133,7 @@
COMPILE_DOWNLOAD_URLS,
COMPILE_MDEF_NAMESPACES,
COMPILE_PARTIAL_TYPESYSTEM,
+ COMPILE_PARTIAL_METHODS,
VALIDATE_ON_SET,
VALIDATE_TREAT_LAX_AS_SKIP,
VALIDATE_STRICT,
@@ -1390,6 +1391,33 @@
return flag != null && flag;
}
+ public enum BeanMethod {
+ GET, XGET, IS_SET, IS_NIL, IS_NIL_IDX, SET, SET_NIL, SET_NIL_IDX, XSET, UNSET,
+ GET_ARRAY, XGET_ARRAY, GET_IDX, XGET_IDX, XSET_ARRAY, XSET_IDX,
+ SIZE_OF_ARRAY, SET_ARRAY, SET_IDX,
+ INSERT_IDX, INSERT_NEW_IDX,
+ ADD, ADD_NEW, REMOVE_IDX,
+ GET_LIST, XGET_LIST, SET_LIST,
+ INSTANCE_TYPE
+ }
+
+ /**
+ * @return the list of methods to be generated in the XmlBean or {@code null} for all
+ */
+ @SuppressWarnings("unchecked")
+ public Set<BeanMethod> getCompilePartialMethod() {
+ return (Set<BeanMethod>)get(XmlOptionsKeys.COMPILE_PARTIAL_METHODS);
+ }
+
+ public void setCompilePartialMethod(Set<BeanMethod> list) {
+ if (list == null || list.isEmpty()) {
+ remove(XmlOptionsKeys.COMPILE_PARTIAL_METHODS);
+ } else {
+ set(XmlOptionsKeys.COMPILE_PARTIAL_METHODS, list);
+ }
+ }
+
+
/**
* If passed null, returns an empty options object. Otherwise, returns its argument.
*/
diff --git a/src/main/java/org/apache/xmlbeans/XmlPositiveInteger.java b/src/main/java/org/apache/xmlbeans/XmlPositiveInteger.java
index cfa2679..6dc6f27 100644
--- a/src/main/java/org/apache/xmlbeans/XmlPositiveInteger.java
+++ b/src/main/java/org/apache/xmlbeans/XmlPositiveInteger.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#positiveInteger">xs:positiveInteger</a> type.
@@ -25,138 +27,11 @@
* Convertible to {@link java.math.BigInteger}.
*/
public interface XmlPositiveInteger extends XmlNonNegativeInteger {
+ XmlObjectFactory<XmlPositiveInteger> Factory = new XmlObjectFactory<>("_BI_positiveInteger");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_positiveInteger");
-
- /**
- * A class with methods for creating instances
- * of {@link XmlPositiveInteger}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlPositiveInteger}
- */
- public static XmlPositiveInteger newInstance() {
- return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlPositiveInteger}
- */
- public static XmlPositiveInteger newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlPositiveInteger} value
- */
- public static XmlPositiveInteger newValue(Object obj) {
- return (XmlPositiveInteger) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlPositiveInteger} fragment from a String. For example: "<code><xml-fragment>1234567890</xml-fragment></code>".
- */
- public static XmlPositiveInteger parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlPositiveInteger} fragment from a String. For example: "<code><xml-fragment>1234567890</xml-fragment></code>".
- */
- public static XmlPositiveInteger parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlPositiveInteger} fragment from a File.
- */
- public static XmlPositiveInteger parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlPositiveInteger} fragment from a File.
- */
- public static XmlPositiveInteger parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlPositiveInteger} fragment from a URL.
- */
- public static XmlPositiveInteger parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlPositiveInteger} fragment from a URL.
- */
- public static XmlPositiveInteger parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlPositiveInteger} fragment from an InputStream.
- */
- public static XmlPositiveInteger parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlPositiveInteger} fragment from an InputStream.
- */
- public static XmlPositiveInteger parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlPositiveInteger} fragment from a Reader.
- */
- public static XmlPositiveInteger parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlPositiveInteger} fragment from a Reader.
- */
- public static XmlPositiveInteger parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlPositiveInteger} fragment from a DOM Node.
- */
- public static XmlPositiveInteger parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlPositiveInteger} fragment from a DOM Node.
- */
- public static XmlPositiveInteger parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlPositiveInteger} fragment from an XMLStreamReader.
- */
- public static XmlPositiveInteger parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlPositiveInteger} fragment from an XMLStreamReader.
- */
- public static XmlPositiveInteger parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
+ SchemaType type = Factory.getType();
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlQName.java b/src/main/java/org/apache/xmlbeans/XmlQName.java
index 7c648c5..eab901f 100644
--- a/src/main/java/org/apache/xmlbeans/XmlQName.java
+++ b/src/main/java/org/apache/xmlbeans/XmlQName.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
import javax.xml.namespace.QName;
@@ -32,10 +34,12 @@
* Convertible to {@link javax.xml.namespace.QName}.
*/
public interface XmlQName extends XmlAnySimpleType {
+ XmlObjectFactory<XmlQName> Factory = new XmlObjectFactory<>("_BI_QName");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_QName");
+ SchemaType type = Factory.getType();
/**
* Returns this value as a {@link QName}
@@ -46,134 +50,5 @@
* Sets this value as a {@link QName}
*/
void setQNameValue(QName name);
-
- /**
- * A class with methods for creating instances
- * of {@link XmlQName}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlQName}
- */
- public static XmlQName newInstance() {
- return (XmlQName) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlQName}
- */
- public static XmlQName newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlQName) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlQName} value
- */
- public static XmlQName newValue(Object obj) {
- return (XmlQName) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlQName} fragment from a String. For example: "<code><xml-fragment xmlns:x="http://openuri.org/">x:sample</xml-fragment></code>".
- */
- public static XmlQName parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlQName) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlQName} fragment from a String. For example: "<code><xml-fragment xmlns:x="http://openuri.org/">x:sample</xml-fragment></code>".
- */
- public static XmlQName parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlQName) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlQName} fragment from a File.
- */
- public static XmlQName parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlQName) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlQName} fragment from a File.
- */
- public static XmlQName parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlQName) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlQName} fragment from a URL.
- */
- public static XmlQName parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlQName) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlQName} fragment from a URL.
- */
- public static XmlQName parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlQName) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlQName} fragment from an InputStream.
- */
- public static XmlQName parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlQName) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlQName} fragment from an InputStream.
- */
- public static XmlQName parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlQName) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlQName} fragment from a Reader.
- */
- public static XmlQName parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlQName) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlQName} fragment from a Reader.
- */
- public static XmlQName parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlQName) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlQName} fragment from a DOM Node.
- */
- public static XmlQName parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlQName) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlQName} fragment from a DOM Node.
- */
- public static XmlQName parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlQName) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlQName} fragment from an XMLStreamReader.
- */
- public static XmlQName parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlQName) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlQName} fragment from an XMLStreamReader.
- */
- public static XmlQName parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlQName) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlShort.java b/src/main/java/org/apache/xmlbeans/XmlShort.java
index 45b362d..726783e 100644
--- a/src/main/java/org/apache/xmlbeans/XmlShort.java
+++ b/src/main/java/org/apache/xmlbeans/XmlShort.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#short">xs:short</a> type.
@@ -23,10 +25,12 @@
* Naturally, convertible to a Java short.
*/
public interface XmlShort extends XmlInt {
+ XmlObjectFactory<XmlShort> Factory = new XmlObjectFactory<>("_BI_short");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_short");
+ SchemaType type = Factory.getType();
/**
* Returns this value as a short
@@ -37,134 +41,5 @@
* Sets this value as a short
*/
void setShortValue(short s);
-
- /**
- * A class with methods for creating instances
- * of {@link XmlShort}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlShort}
- */
- public static XmlShort newInstance() {
- return (XmlShort) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlShort}
- */
- public static XmlShort newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlShort) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlShort} value
- */
- public static XmlShort newValue(Object obj) {
- return (XmlShort) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlShort} fragment from a String. For example: "<code><xml-fragment>12345</xml-fragment></code>".
- */
- public static XmlShort parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlShort) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlShort} fragment from a String. For example: "<code><xml-fragment>12345</xml-fragment></code>".
- */
- public static XmlShort parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlShort) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlShort} fragment from a File.
- */
- public static XmlShort parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlShort) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlShort} fragment from a File.
- */
- public static XmlShort parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlShort) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlShort} fragment from a URL.
- */
- public static XmlShort parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlShort) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlShort} fragment from a URL.
- */
- public static XmlShort parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlShort) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlShort} fragment from an InputStream.
- */
- public static XmlShort parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlShort) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlShort} fragment from an InputStream.
- */
- public static XmlShort parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlShort) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlShort} fragment from a Reader.
- */
- public static XmlShort parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlShort) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlShort} fragment from a Reader.
- */
- public static XmlShort parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlShort) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlShort} fragment from a DOM Node.
- */
- public static XmlShort parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlShort) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlShort} fragment from a DOM Node.
- */
- public static XmlShort parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlShort) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlShort} fragment from an XMLStreamReader.
- */
- public static XmlShort parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlShort) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlShort} fragment from an XMLStreamReader.
- */
- public static XmlShort parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlShort) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlString.java b/src/main/java/org/apache/xmlbeans/XmlString.java
index b05a72e..efdf168 100644
--- a/src/main/java/org/apache/xmlbeans/XmlString.java
+++ b/src/main/java/org/apache/xmlbeans/XmlString.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#string">xs:string</a> type.
@@ -32,138 +34,11 @@
* Convertible to {@link String}.
*/
public interface XmlString extends XmlAnySimpleType {
+ XmlObjectFactory<XmlString> Factory = new XmlObjectFactory<>("_BI_string");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_string");
-
- /**
- * A class with methods for creating instances
- * of {@link XmlString}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlString}
- */
- public static XmlString newInstance() {
- return (XmlString) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlString}
- */
- public static XmlString newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlString) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlString} value
- */
- public static XmlString newValue(Object obj) {
- return (XmlString) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlString} fragment from a String. For example: "<code><xml-fragment> arbitrary string </xml-fragment></code>".
- */
- public static XmlString parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlString) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlString} fragment from a String. For example: "<code><xml-fragment> arbitrary string </xml-fragment></code>".
- */
- public static XmlString parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlString) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlString} fragment from a File.
- */
- public static XmlString parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlString) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlString} fragment from a File.
- */
- public static XmlString parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlString) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlString} fragment from a URL.
- */
- public static XmlString parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlString) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlString} fragment from a URL.
- */
- public static XmlString parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlString) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlString} fragment from an InputStream.
- */
- public static XmlString parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlString) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlString} fragment from an InputStream.
- */
- public static XmlString parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlString) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlString} fragment from a Reader.
- */
- public static XmlString parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlString) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlString} fragment from a Reader.
- */
- public static XmlString parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlString) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlString} fragment from a DOM Node.
- */
- public static XmlString parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlString) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlString} fragment from a DOM Node.
- */
- public static XmlString parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlString) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlString} fragment from an XMLStreamReader.
- */
- public static XmlString parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlString) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlString} fragment from an XMLStreamReader.
- */
- public static XmlString parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlString) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
+ SchemaType type = Factory.getType();
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlTime.java b/src/main/java/org/apache/xmlbeans/XmlTime.java
index c3a1aeb..8d43c3c 100644
--- a/src/main/java/org/apache/xmlbeans/XmlTime.java
+++ b/src/main/java/org/apache/xmlbeans/XmlTime.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
import java.util.Calendar;
@@ -29,10 +31,12 @@
* @see GDate
*/
public interface XmlTime extends XmlAnySimpleType {
+ XmlObjectFactory<XmlTime> Factory = new XmlObjectFactory<>("_BI_time");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_time");
+ SchemaType type = Factory.getType();
/**
* Returns this value as a {@link Calendar}
@@ -53,134 +57,5 @@
* Sets this value as a {@link GDateSpecification}
*/
void setGDateValue(GDate gd);
-
- /**
- * A class with methods for creating instances
- * of {@link XmlTime}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlTime}
- */
- public static XmlTime newInstance() {
- return (XmlTime) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlTime}
- */
- public static XmlTime newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlTime) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlTime} value
- */
- public static XmlTime newValue(Object obj) {
- return (XmlTime) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlTime} fragment from a String. For example: "<code><xml-fragment>12:00:00</xml-fragment></code>".
- */
- public static XmlTime parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlTime) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlTime} fragment from a String. For example: "<code><xml-fragment>12:00:00</xml-fragment></code>".
- */
- public static XmlTime parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlTime) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlTime} fragment from a File.
- */
- public static XmlTime parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlTime) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlTime} fragment from a File.
- */
- public static XmlTime parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlTime) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlTime} fragment from a URL.
- */
- public static XmlTime parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlTime) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlTime} fragment from a URL.
- */
- public static XmlTime parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlTime) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlTime} fragment from an InputStream.
- */
- public static XmlTime parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlTime) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlTime} fragment from an InputStream.
- */
- public static XmlTime parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlTime) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlTime} fragment from a Reader.
- */
- public static XmlTime parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlTime) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlTime} fragment from a Reader.
- */
- public static XmlTime parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlTime) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlTime} fragment from a DOM Node.
- */
- public static XmlTime parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlTime) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlTime} fragment from a DOM Node.
- */
- public static XmlTime parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlTime) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlTime} fragment from an XMLStreamReader.
- */
- public static XmlTime parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlTime) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlTime} fragment from an XMLStreamReader.
- */
- public static XmlTime parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlTime) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlToken.java b/src/main/java/org/apache/xmlbeans/XmlToken.java
index f209dd1..c2a93fe 100644
--- a/src/main/java/org/apache/xmlbeans/XmlToken.java
+++ b/src/main/java/org/apache/xmlbeans/XmlToken.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#token">xs:token</a> type.
@@ -36,138 +38,11 @@
* Convertible to {@link String}.
*/
public interface XmlToken extends XmlNormalizedString {
+ XmlObjectFactory<XmlToken> Factory = new XmlObjectFactory<>("_BI_token");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_token");
-
- /**
- * A class with methods for creating instances
- * of {@link XmlToken}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlToken}
- */
- public static XmlToken newInstance() {
- return (XmlToken) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlToken}
- */
- public static XmlToken newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlToken) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlToken} value
- */
- public static XmlToken newValue(Object obj) {
- return (XmlToken) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlToken} fragment from a String. For example: "<code><xml-fragment>string to collapse</xml-fragment></code>".
- */
- public static XmlToken parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlToken) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlToken} fragment from a String. For example: "<code><xml-fragment>string to collapse</xml-fragment></code>".
- */
- public static XmlToken parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlToken) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlToken} fragment from a File.
- */
- public static XmlToken parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlToken) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlToken} fragment from a File.
- */
- public static XmlToken parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlToken) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlToken} fragment from a URL.
- */
- public static XmlToken parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlToken) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlToken} fragment from a URL.
- */
- public static XmlToken parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlToken) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlToken} fragment from an InputStream.
- */
- public static XmlToken parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlToken) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlToken} fragment from an InputStream.
- */
- public static XmlToken parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlToken) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlToken} fragment from a Reader.
- */
- public static XmlToken parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlToken) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlToken} fragment from a Reader.
- */
- public static XmlToken parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlToken) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlToken} fragment from a DOM Node.
- */
- public static XmlToken parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlToken) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlToken} fragment from a DOM Node.
- */
- public static XmlToken parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlToken) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlToken} fragment from an XMLStreamReader.
- */
- public static XmlToken parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlToken) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlToken} fragment from an XMLStreamReader.
- */
- public static XmlToken parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlToken) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
+ SchemaType type = Factory.getType();
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlUnsignedByte.java b/src/main/java/org/apache/xmlbeans/XmlUnsignedByte.java
index 32f3e67..1f2fee2 100644
--- a/src/main/java/org/apache/xmlbeans/XmlUnsignedByte.java
+++ b/src/main/java/org/apache/xmlbeans/XmlUnsignedByte.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#unsignedByte">xs:unsignedByte</a> type.
@@ -25,10 +27,12 @@
* As suggested by JAXB, convertible to Java short.
*/
public interface XmlUnsignedByte extends XmlUnsignedShort {
+ XmlObjectFactory<XmlUnsignedByte> Factory = new XmlObjectFactory<>("_BI_unsignedByte");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_unsignedByte");
+ SchemaType type = Factory.getType();
/**
* Returns this value as a short
@@ -39,135 +43,5 @@
* Sets this value as a short
*/
void setShortValue(short s);
-
-
- /**
- * A class with methods for creating instances
- * of {@link XmlUnsignedByte}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlUnsignedByte}
- */
- public static XmlUnsignedByte newInstance() {
- return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlUnsignedByte}
- */
- public static XmlUnsignedByte newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlUnsignedByte} value
- */
- public static XmlUnsignedByte newValue(Object obj) {
- return (XmlUnsignedByte) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlUnsignedByte} fragment from a String. For example: "<code><xml-fragment>123</xml-fragment></code>".
- */
- public static XmlUnsignedByte parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedByte} fragment from a String. For example: "<code><xml-fragment>123</xml-fragment></code>".
- */
- public static XmlUnsignedByte parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlUnsignedByte} fragment from a File.
- */
- public static XmlUnsignedByte parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedByte} fragment from a File.
- */
- public static XmlUnsignedByte parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlUnsignedByte} fragment from a URL.
- */
- public static XmlUnsignedByte parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedByte} fragment from a URL.
- */
- public static XmlUnsignedByte parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlUnsignedByte} fragment from an InputStream.
- */
- public static XmlUnsignedByte parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedByte} fragment from an InputStream.
- */
- public static XmlUnsignedByte parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlUnsignedByte} fragment from a Reader.
- */
- public static XmlUnsignedByte parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedByte} fragment from a Reader.
- */
- public static XmlUnsignedByte parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlUnsignedByte} fragment from a DOM Node.
- */
- public static XmlUnsignedByte parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedByte} fragment from a DOM Node.
- */
- public static XmlUnsignedByte parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlUnsignedByte} fragment from an XMLStreamReader.
- */
- public static XmlUnsignedByte parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedByte} fragment from an XMLStreamReader.
- */
- public static XmlUnsignedByte parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlUnsignedInt.java b/src/main/java/org/apache/xmlbeans/XmlUnsignedInt.java
index d1869e0..fc3597c 100644
--- a/src/main/java/org/apache/xmlbeans/XmlUnsignedInt.java
+++ b/src/main/java/org/apache/xmlbeans/XmlUnsignedInt.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#unsignedInt">xs:unsignedInt</a> type.
@@ -25,10 +27,12 @@
* Convertible to Java long.
*/
public interface XmlUnsignedInt extends XmlUnsignedLong {
+ XmlObjectFactory<XmlUnsignedInt> Factory = new XmlObjectFactory<>("_BI_unsignedInt");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_unsignedInt");
+ SchemaType type = Factory.getType();
/**
* Returns this value as a long
@@ -39,134 +43,5 @@
* Sets this value as a long
*/
void setLongValue(long v);
-
- /**
- * A class with methods for creating instances
- * of {@link XmlUnsignedInt}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlUnsignedInt}
- */
- public static XmlUnsignedInt newInstance() {
- return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlUnsignedInt}
- */
- public static XmlUnsignedInt newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlUnsignedInt} value
- */
- public static XmlUnsignedInt newValue(Object obj) {
- return (XmlUnsignedInt) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlUnsignedInt} fragment from a String. For example: "<code><xml-fragment>1234567</xml-fragment></code>".
- */
- public static XmlUnsignedInt parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedInt} fragment from a String. For example: "<code><xml-fragment>1234567</xml-fragment></code>".
- */
- public static XmlUnsignedInt parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlUnsignedInt} fragment from a File.
- */
- public static XmlUnsignedInt parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedInt} fragment from a File.
- */
- public static XmlUnsignedInt parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlUnsignedInt} fragment from a URL.
- */
- public static XmlUnsignedInt parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedInt} fragment from a URL.
- */
- public static XmlUnsignedInt parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlUnsignedInt} fragment from an InputStream.
- */
- public static XmlUnsignedInt parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedInt} fragment from an InputStream.
- */
- public static XmlUnsignedInt parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlUnsignedInt} fragment from a Reader.
- */
- public static XmlUnsignedInt parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedInt} fragment from a Reader.
- */
- public static XmlUnsignedInt parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlUnsignedInt} fragment from a DOM Node.
- */
- public static XmlUnsignedInt parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedInt} fragment from a DOM Node.
- */
- public static XmlUnsignedInt parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlUnsignedInt} fragment from an XMLStreamReader.
- */
- public static XmlUnsignedInt parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedInt} fragment from an XMLStreamReader.
- */
- public static XmlUnsignedInt parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlUnsignedLong.java b/src/main/java/org/apache/xmlbeans/XmlUnsignedLong.java
index 8b55954..dcdc83e 100644
--- a/src/main/java/org/apache/xmlbeans/XmlUnsignedLong.java
+++ b/src/main/java/org/apache/xmlbeans/XmlUnsignedLong.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
import java.math.BigInteger;
@@ -28,138 +30,11 @@
* Convertible to {@link BigInteger}.
*/
public interface XmlUnsignedLong extends XmlNonNegativeInteger {
+ XmlObjectFactory<XmlUnsignedLong> Factory = new XmlObjectFactory<>("_BI_unsignedLong");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_unsignedLong");
-
- /**
- * A class with methods for creating instances
- * of {@link XmlUnsignedLong}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlUnsignedLong}
- */
- public static XmlUnsignedLong newInstance() {
- return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlUnsignedLong}
- */
- public static XmlUnsignedLong newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlUnsignedLong} value
- */
- public static XmlUnsignedLong newValue(Object obj) {
- return (XmlUnsignedLong) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlUnsignedLong} fragment from a String. For example: "<code><xml-fragment>123456789</xml-fragment></code>".
- */
- public static XmlUnsignedLong parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedLong} fragment from a String. For example: "<code><xml-fragment>123456789</xml-fragment></code>".
- */
- public static XmlUnsignedLong parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlUnsignedLong} fragment from a File.
- */
- public static XmlUnsignedLong parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedLong} fragment from a File.
- */
- public static XmlUnsignedLong parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlUnsignedLong} fragment from a URL.
- */
- public static XmlUnsignedLong parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedLong} fragment from a URL.
- */
- public static XmlUnsignedLong parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlUnsignedLong} fragment from an InputStream.
- */
- public static XmlUnsignedLong parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedLong} fragment from an InputStream.
- */
- public static XmlUnsignedLong parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlUnsignedLong} fragment from a Reader.
- */
- public static XmlUnsignedLong parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedLong} fragment from a Reader.
- */
- public static XmlUnsignedLong parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlUnsignedLong} fragment from a DOM Node.
- */
- public static XmlUnsignedLong parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedLong} fragment from a DOM Node.
- */
- public static XmlUnsignedLong parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlUnsignedLong} fragment from an XMLStreamReader.
- */
- public static XmlUnsignedLong parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedLong} fragment from an XMLStreamReader.
- */
- public static XmlUnsignedLong parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
+ SchemaType type = Factory.getType();
}
diff --git a/src/main/java/org/apache/xmlbeans/XmlUnsignedShort.java b/src/main/java/org/apache/xmlbeans/XmlUnsignedShort.java
index 05c21dc..dfbcb3e 100644
--- a/src/main/java/org/apache/xmlbeans/XmlUnsignedShort.java
+++ b/src/main/java/org/apache/xmlbeans/XmlUnsignedShort.java
@@ -15,6 +15,8 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.XmlObjectFactory;
+
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#unsignedShort">xs:unsignedShort</a> type.
@@ -25,10 +27,12 @@
* Convertible to a Java int.
*/
public interface XmlUnsignedShort extends XmlUnsignedInt {
+ XmlObjectFactory<XmlUnsignedShort> Factory = new XmlObjectFactory<>("_BI_unsignedShort");
+
/**
* The constant {@link SchemaType} object representing this schema type.
*/
- SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_unsignedShort");
+ SchemaType type = Factory.getType();
/**
* Returns this value as an int
@@ -39,134 +43,5 @@
* Sets this value as an int
*/
void setIntValue(int v);
-
- /**
- * A class with methods for creating instances
- * of {@link XmlUnsignedShort}.
- */
- final class Factory {
- /**
- * Creates an empty instance of {@link XmlUnsignedShort}
- */
- public static XmlUnsignedShort newInstance() {
- return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().newInstance(type, null);
- }
-
- /**
- * Creates an empty instance of {@link XmlUnsignedShort}
- */
- public static XmlUnsignedShort newInstance(org.apache.xmlbeans.XmlOptions options) {
- return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().newInstance(type, options);
- }
-
- /**
- * Creates an immutable {@link XmlUnsignedShort} value
- */
- public static XmlUnsignedShort newValue(Object obj) {
- return (XmlUnsignedShort) type.newValue(obj);
- }
-
- /**
- * Parses a {@link XmlUnsignedShort} fragment from a String. For example: "<code><xml-fragment>12345</xml-fragment></code>".
- */
- public static XmlUnsignedShort parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
- return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse(s, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedShort} fragment from a String. For example: "<code><xml-fragment>12345</xml-fragment></code>".
- */
- public static XmlUnsignedShort parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse(s, type, options);
- }
-
- /**
- * Parses a {@link XmlUnsignedShort} fragment from a File.
- */
- public static XmlUnsignedShort parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse(f, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedShort} fragment from a File.
- */
- public static XmlUnsignedShort parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse(f, type, options);
- }
-
- /**
- * Parses a {@link XmlUnsignedShort} fragment from a URL.
- */
- public static XmlUnsignedShort parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse(u, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedShort} fragment from a URL.
- */
- public static XmlUnsignedShort parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse(u, type, options);
- }
-
- /**
- * Parses a {@link XmlUnsignedShort} fragment from an InputStream.
- */
- public static XmlUnsignedShort parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse(is, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedShort} fragment from an InputStream.
- */
- public static XmlUnsignedShort parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse(is, type, options);
- }
-
- /**
- * Parses a {@link XmlUnsignedShort} fragment from a Reader.
- */
- public static XmlUnsignedShort parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse(r, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedShort} fragment from a Reader.
- */
- public static XmlUnsignedShort parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
- return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse(r, type, options);
- }
-
- /**
- * Parses a {@link XmlUnsignedShort} fragment from a DOM Node.
- */
- public static XmlUnsignedShort parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
- return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse(node, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedShort} fragment from a DOM Node.
- */
- public static XmlUnsignedShort parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse(node, type, options);
- }
-
- /**
- * Parses a {@link XmlUnsignedShort} fragment from an XMLStreamReader.
- */
- public static XmlUnsignedShort parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
- return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse(xsr, type, null);
- }
-
- /**
- * Parses a {@link XmlUnsignedShort} fragment from an XMLStreamReader.
- */
- public static XmlUnsignedShort parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
- return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse(xsr, type, options);
- }
-
- private Factory() {
- // No instance of this class allowed
- }
- }
}
diff --git a/src/main/java/org/apache/xmlbeans/impl/schema/AbstractDocumentFactory.java b/src/main/java/org/apache/xmlbeans/impl/schema/AbstractDocumentFactory.java
new file mode 100644
index 0000000..5fd80c5
--- /dev/null
+++ b/src/main/java/org/apache/xmlbeans/impl/schema/AbstractDocumentFactory.java
@@ -0,0 +1,97 @@
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xmlbeans.impl.schema;
+
+import org.apache.xmlbeans.SchemaTypeSystem;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlOptions;
+import org.w3c.dom.Node;
+
+import javax.xml.stream.XMLStreamReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.net.URL;
+
+@SuppressWarnings("unchecked")
+public class AbstractDocumentFactory<T> extends ElementFactory<T> {
+ public AbstractDocumentFactory(SchemaTypeSystem typeSystem, String typeHandle) {
+ super(typeSystem, typeHandle);
+ }
+
+ /**
+ * @param xmlAsString the string value to parse
+ */
+ public T parse(String xmlAsString) throws XmlException {
+ return (T) getTypeLoader().parse(xmlAsString, getType(), null);
+ }
+
+ public T parse(String xmlAsString, XmlOptions options) throws XmlException {
+ return (T) getTypeLoader().parse(xmlAsString, getType(), options);
+ }
+
+ /**
+ * @param file the file from which to load an xml document
+ */
+ public T parse(File file) throws XmlException, IOException {
+ return (T) getTypeLoader().parse(file, getType(), null);
+ }
+
+ public T parse(File file, XmlOptions options) throws XmlException, IOException {
+ return (T) getTypeLoader().parse(file, getType(), options);
+ }
+
+ public T parse(URL u) throws XmlException, IOException {
+ return (T) getTypeLoader().parse(u, getType(), null);
+ }
+
+ public T parse(URL u, XmlOptions options) throws XmlException, IOException {
+ return (T) getTypeLoader().parse(u, getType(), options);
+ }
+
+ public T parse(InputStream is) throws XmlException, IOException {
+ return (T) getTypeLoader().parse(is, getType(), null);
+ }
+
+ public T parse(InputStream is, XmlOptions options) throws XmlException, IOException {
+ return (T) getTypeLoader().parse(is, getType(), options);
+ }
+
+ public T parse(Reader r) throws XmlException, IOException {
+ return (T) getTypeLoader().parse(r, getType(), null);
+ }
+
+ public T parse(Reader r, XmlOptions options) throws XmlException, IOException {
+ return (T) getTypeLoader().parse(r, getType(), options);
+ }
+
+ public T parse(XMLStreamReader sr) throws XmlException {
+ return (T) getTypeLoader().parse(sr, getType(), null);
+ }
+
+ public T parse(XMLStreamReader sr, XmlOptions options) throws XmlException {
+ return (T) getTypeLoader().parse(sr, getType(), options);
+ }
+
+ public T parse(Node node) throws XmlException {
+ return (T) getTypeLoader().parse(node, getType(), null);
+ }
+
+ public T parse(Node node, XmlOptions options) throws XmlException {
+ return (T) getTypeLoader().parse(node, getType(), options);
+ }
+}
diff --git a/src/main/java/org/apache/xmlbeans/impl/schema/DocumentFactory.java b/src/main/java/org/apache/xmlbeans/impl/schema/DocumentFactory.java
new file mode 100644
index 0000000..50eace7
--- /dev/null
+++ b/src/main/java/org/apache/xmlbeans/impl/schema/DocumentFactory.java
@@ -0,0 +1,34 @@
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xmlbeans.impl.schema;
+
+import org.apache.xmlbeans.SchemaTypeSystem;
+
+@SuppressWarnings("unchecked")
+public class DocumentFactory<T> extends AbstractDocumentFactory<T> {
+ public DocumentFactory(SchemaTypeSystem typeSystem, String typeHandle) {
+ super(typeSystem, typeHandle);
+ }
+
+ public T newInstance() {
+ return (T) getTypeLoader().newInstance(getType(), null);
+ }
+
+
+ public T newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (T) getTypeLoader().newInstance(getType(), options);
+ }
+}
diff --git a/src/main/java/org/apache/xmlbeans/impl/schema/ElementFactory.java b/src/main/java/org/apache/xmlbeans/impl/schema/ElementFactory.java
new file mode 100644
index 0000000..cf0ebc3
--- /dev/null
+++ b/src/main/java/org/apache/xmlbeans/impl/schema/ElementFactory.java
@@ -0,0 +1,47 @@
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xmlbeans.impl.schema;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.SchemaTypeSystem;
+import org.apache.xmlbeans.XmlOptions;
+
+@SuppressWarnings("unchecked")
+public class ElementFactory<T> {
+ private final SchemaType type;
+ private final SchemaTypeSystem typeSystem;
+
+ public ElementFactory(SchemaTypeSystem typeSystem, String typeHandle) {
+ this.typeSystem = typeSystem;
+ this.type = (SchemaType)typeSystem.resolveHandle(typeHandle);
+ }
+
+ public SchemaType getType() {
+ return type;
+ }
+
+ public SchemaTypeSystem getTypeLoader() {
+ return typeSystem;
+ }
+
+ public T newInstance() {
+ return (T) getTypeLoader().newInstance(type, null);
+ }
+
+ public T newInstance(XmlOptions options) {
+ return (T) getTypeLoader().newInstance(type, options);
+ }
+}
diff --git a/src/main/java/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java b/src/main/java/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
index 10318c4..aa5c756 100644
--- a/src/main/java/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
+++ b/src/main/java/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
@@ -16,6 +16,7 @@
package org.apache.xmlbeans.impl.schema;
import org.apache.xmlbeans.*;
+import org.apache.xmlbeans.XmlOptions.BeanMethod;
import org.apache.xmlbeans.impl.common.NameUtil;
import javax.xml.namespace.QName;
@@ -30,36 +31,14 @@
* Prints the java code for a single schema type
*/
public final class SchemaTypeCodePrinter implements SchemaCodePrinter {
- Writer _writer;
- int _indent;
+ static final String INDEX_CLASSNAME = "TypeSystemHolder";
+ private static final String MAX_SPACES = " ";
+ private static final int INDENT_INCREMENT = 4;
- static final String LINE_SEPARATOR =
- SystemProperties.getProperty("line.separator") == null
- ? "\n"
- : SystemProperties.getProperty("line.separator");
-
- static final String MAX_SPACES = " ";
- static final int INDENT_INCREMENT = 4;
-
- public static final String INDEX_CLASSNAME = "TypeSystemHolder";
-
- public static void printTypeImpl(Writer writer, SchemaType sType,
- XmlOptions opt)
- throws IOException {
- getPrinter(opt).printTypeImpl(writer, sType);
- }
-
- public static void printType(Writer writer, SchemaType sType,
- XmlOptions opt)
- throws IOException {
- getPrinter(opt).printType(writer, sType);
- }
-
- private static SchemaCodePrinter getPrinter(XmlOptions opt) {
- SchemaCodePrinter printer = opt == null ? null : opt.getSchemaCodePrinter();
- return printer == null ? new SchemaTypeCodePrinter() : printer;
- }
+ private Writer _writer;
+ private int _indent;
+ private XmlOptions opt;
public SchemaTypeCodePrinter() {
_indent = 0;
@@ -73,27 +52,33 @@
_indent -= INDENT_INCREMENT;
}
+ void emit(String s, BeanMethod method) throws IOException {
+ Set<BeanMethod> partMet = opt == null ? null : opt.getCompilePartialMethod();
+ if ((partMet == null || partMet.contains(method))) {
+ emit(s);
+ }
+ }
+
void emit(String s) throws IOException {
- int indent = _indent;
+ if (!s.trim().isEmpty()) {
+ int indent = _indent;
- if (indent > MAX_SPACES.length() / 2) {
- indent = MAX_SPACES.length() / 4 + indent / 2;
+ if (indent > MAX_SPACES.length() / 2) {
+ indent = MAX_SPACES.length() / 4 + indent / 2;
+ }
+
+ if (indent > MAX_SPACES.length()) {
+ indent = MAX_SPACES.length();
+ }
+
+ _writer.write(MAX_SPACES.substring(0, indent));
}
-
- if (indent > MAX_SPACES.length()) {
- indent = MAX_SPACES.length();
- }
-
- _writer.write(MAX_SPACES.substring(0, indent));
try {
_writer.write(s);
} catch (CharacterCodingException cce) {
_writer.write(makeSafe(s));
}
- _writer.write(LINE_SEPARATOR);
-
- // System.out.print(MAX_SPACES.substring(0, indent));
- // System.out.println(s);
+ _writer.write(System.lineSeparator());
}
private static String makeSafe(String s) {
@@ -134,20 +119,32 @@
return result.toString();
}
- public void printType(Writer writer, SchemaType sType) throws IOException {
+ @Override
+ public void printType(Writer writer, SchemaType sType, XmlOptions opt) throws IOException {
+ this.opt = opt;
_writer = writer;
printTopComment(sType);
printPackage(sType, true);
emit("");
+ emit("import "+ElementFactory.class.getName()+";");
+ emit("import " + AbstractDocumentFactory.class.getName() + ";");
+ emit("import " + DocumentFactory.class.getName() + ";");
+ emit("import " + SimpleTypeFactory.class.getName() + ";");
+ emit("");
printInnerType(sType, sType.getTypeSystem());
_writer.flush();
}
- public void printTypeImpl(Writer writer, SchemaType sType)
- throws IOException {
+ @Override
+ public void printTypeImpl(Writer writer, SchemaType sType, XmlOptions opt) throws IOException {
+ this.opt = opt;
_writer = writer;
printTopComment(sType);
printPackage(sType, false);
+ emit("");
+ emit("import javax.xml.namespace.QName;");
+ emit("import org.apache.xmlbeans.QNameSet;");
+ emit("");
printInnerTypeImpl(sType, sType.getTypeSystem(), false);
}
@@ -252,10 +249,29 @@
}
void printStaticTypeDeclaration(SchemaType sType, SchemaTypeSystem system) throws IOException {
- emit("org.apache.xmlbeans.SchemaType type = (org.apache.xmlbeans.SchemaType)");
- indent();
- emit("Factory.getTypeLoader().resolveHandle(\"" + ((SchemaTypeSystemImpl) system).handleForType(sType) + "\");");
- outdent();
+ // Only need full factories for top-level types
+ Class<?> factoryClass;
+ if (sType.isAnonymousType() && !sType.isDocumentType() && !sType.isAttributeType()) {
+ factoryClass = ElementFactory.class;
+ } else if (sType.isSimpleType()) {
+ factoryClass = SimpleTypeFactory.class;
+ } else if (sType.isAbstract()) {
+ factoryClass = AbstractDocumentFactory.class;
+ } else {
+ factoryClass = DocumentFactory.class;
+ }
+
+ String factoryName = factoryClass.getSimpleName();
+
+ String fullName = sType.getFullJavaName().replace('$', '.');
+ String sysName = sType.getTypeSystem().getName();
+
+
+ emit(factoryName + "<" + fullName + "> Factory = new " + factoryName +
+ "<>(" + sysName + ".TypeSystemHolder.typeSystem, \"" + ((SchemaTypeSystemImpl) system).handleForType(sType) + "\");"
+ );
+ emit("org.apache.xmlbeans.SchemaType type = Factory.getType();");
+ emit("");
}
void printInnerType(SchemaType sType, SchemaTypeSystem system) throws IOException {
@@ -279,32 +295,10 @@
SchemaProperty[] props = getDerivedProperties(sType);
for (SchemaProperty prop : props) {
- printPropertyGetters(
- prop.getName(),
- prop.isAttribute(),
- prop.getJavaPropertyName(),
- prop.getJavaTypeCode(),
- javaTypeForProperty(prop),
- xmlTypeForProperty(prop),
- prop.hasNillable() != SchemaProperty.NEVER,
- prop.extendsJavaOption(),
- prop.extendsJavaArray(),
- prop.extendsJavaSingleton()
- );
+ printPropertyGetters(prop);
if (!prop.isReadOnly()) {
- printPropertySetters(
- prop.getName(),
- prop.isAttribute(),
- prop.getJavaPropertyName(),
- prop.getJavaTypeCode(),
- javaTypeForProperty(prop),
- xmlTypeForProperty(prop),
- prop.hasNillable() != SchemaProperty.NEVER,
- prop.extendsJavaOption(),
- prop.extendsJavaArray(),
- prop.extendsJavaSingleton()
- );
+ printPropertySetters(prop);
}
}
@@ -312,119 +306,9 @@
printNestedInnerTypes(sType, system);
- printFactory(sType);
-
endBlock();
}
- void printFactory(SchemaType sType) throws IOException {
- // Only need full factories for top-level types
- boolean fullFactory = true;
- if (sType.isAnonymousType() && !sType.isDocumentType() && !sType.isAttributeType()) {
- fullFactory = false;
- }
-
- String fullName = sType.getFullJavaName().replace('$', '.');
-
- emit("");
- emit("/**");
- emit(" * A factory class with static methods for creating instances");
- emit(" * of this type.");
- emit(" */");
- emit("");
- // BUGBUG - Can I use the name loader here? could it be a
- // nested type name? It is lower case!
- emit("final class Factory");
- emit("{");
- indent();
-
- emit("private static synchronized " + sType.getTypeSystem().getName() + ".TypeSystemHolder getTypeLoader() {");
- emit(" return " + sType.getTypeSystem().getName() + ".TypeSystemHolder.typeSystem;");
- emit("}");
- emit("");
-
- if (sType.isSimpleType()) {
- emit("public static " + fullName + " newValue(java.lang.Object obj) {");
- emit(" return (" + fullName + ") type.newValue( obj ); }");
- emit("");
- }
-
- // Only need newInstance() for non-abstract types
- if (!sType.isAbstract()) {
- emit("public static " + fullName + " newInstance() {");
- emit(" return (" + fullName + ") getTypeLoader().newInstance( type, null ); }");
- emit("");
-
- emit("public static " + fullName + " newInstance(org.apache.xmlbeans.XmlOptions options) {");
- emit(" return (" + fullName + ") getTypeLoader().newInstance( type, options ); }");
- emit("");
- }
-
- if (fullFactory) {
- emit("/** @param xmlAsString the string value to parse */");
- emit("public static " + fullName + " parse(java.lang.String xmlAsString) throws org.apache.xmlbeans.XmlException {");
- emit(" return (" + fullName + ") getTypeLoader().parse( xmlAsString, type, null ); }");
- emit("");
-
- emit("public static " + fullName + " parse(java.lang.String xmlAsString, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {");
- emit(" return (" + fullName + ") getTypeLoader().parse( xmlAsString, type, options ); }");
- emit("");
-
- emit("/** @param file the file from which to load an xml document */");
- emit("public static " + fullName + " parse(java.io.File file) throws org.apache.xmlbeans.XmlException, java.io.IOException {");
- emit(" return (" + fullName + ") getTypeLoader().parse( file, type, null ); }");
- emit("");
-
- emit("public static " + fullName + " parse(java.io.File file, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {");
- emit(" return (" + fullName + ") getTypeLoader().parse( file, type, options ); }");
- emit("");
-
- emit("public static " + fullName + " parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {");
- emit(" return (" + fullName + ") getTypeLoader().parse( u, type, null ); }");
- emit("");
-
- emit("public static " + fullName + " parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {");
- emit(" return (" + fullName + ") getTypeLoader().parse( u, type, options ); }");
- emit("");
-
- emit("public static " + fullName + " parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {");
- emit(" return (" + fullName + ") getTypeLoader().parse( is, type, null ); }");
- emit("");
-
- emit("public static " + fullName + " parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {");
- emit(" return (" + fullName + ") getTypeLoader().parse( is, type, options ); }");
- emit("");
-
- emit("public static " + fullName + " parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {");
- emit(" return (" + fullName + ") getTypeLoader().parse( r, type, null ); }");
- emit("");
-
- emit("public static " + fullName + " parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {");
- emit(" return (" + fullName + ") getTypeLoader().parse( r, type, options ); }");
- emit("");
-
- emit("public static " + fullName + " parse(javax.xml.stream.XMLStreamReader sr) throws org.apache.xmlbeans.XmlException {");
- emit(" return (" + fullName + ") getTypeLoader().parse( sr, type, null ); }");
- emit("");
-
- emit("public static " + fullName + " parse(javax.xml.stream.XMLStreamReader sr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {");
- emit(" return (" + fullName + ") getTypeLoader().parse( sr, type, options ); }");
- emit("");
-
- emit("public static " + fullName + " parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {");
- emit(" return (" + fullName + ") getTypeLoader().parse( node, type, null ); }");
- emit("");
-
- emit("public static " + fullName + " parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {");
- emit(" return (" + fullName + ") getTypeLoader().parse( node, type, options ); }");
- emit("");
- }
-
- emit("private Factory() { } // No instance of this class allowed");
- outdent();
- emit("}");
- }
-
void printNestedInnerTypes(SchemaType sType, SchemaTypeSystem system) throws IOException {
boolean redefinition = sType.getName() != null &&
sType.getName().equals(sType.getBaseType().getName());
@@ -497,32 +381,6 @@
String baseInterface = findJavaType(sType.getBaseType());
- /*
- StringBuffer specializedInterfaces = new StringBuffer();
-
- if (sType.getSimpleVariety() == SchemaType.ATOMIC &&
- sType.getPrimitiveType().getBuiltinTypeCode() == SchemaType.BTC_DECIMAL)
- {
- int bits = sType.getDecimalSize();
- if (bits == SchemaType.SIZE_BIG_INTEGER)
- specializedInterfaces.append(", org.apache.xmlbeans.BigIntegerValue");
- if (bits == SchemaType.SIZE_LONG)
- specializedInterfaces.append(", org.apache.xmlbeans.LongValue");
- if (bits <= SchemaType.SIZE_INT)
- specializedInterfaces.append(", org.apache.xmlbeans.IntValue");
- }
- if (sType.getSimpleVariety() == SchemaType.LIST)
- specializedInterfaces.append(", org.apache.xmlbeans.ListValue");
-
- if (sType.getSimpleVariety() == SchemaType.UNION)
- {
- SchemaType ctype = sType.getUnionCommonBaseType();
- String javaTypeHolder = javaTypeHolderForType(ctype);
- if (javaTypeHolder != null)
- specializedInterfaces.append(", " + javaTypeHolder);
- }
- */
-
emit("public interface " + shortName + " extends " + baseInterface + getExtensionInterfaces(sType));
emit("{");
indent();
@@ -561,29 +419,35 @@
int bits = sType.getDecimalSize();
int parentBits = sType.getBaseType().getDecimalSize();
if (bits != parentBits || sType.getBaseType().getFullJavaName() == null) {
- if (bits == SchemaType.SIZE_BIG_INTEGER) {
- emit("java.math.BigInteger getBigIntegerValue();");
- emit("void setBigIntegerValue(java.math.BigInteger bi);");
- } else if (bits == SchemaType.SIZE_LONG) {
- emit("long getLongValue();");
- emit("void setLongValue(long l);");
- } else if (bits == SchemaType.SIZE_INT) {
- emit("int getIntValue();");
- emit("void setIntValue(int i);");
- } else if (bits == SchemaType.SIZE_SHORT) {
- emit("short getShortValue();");
- emit("void setShortValue(short s);");
- } else if (bits == SchemaType.SIZE_BYTE) {
- emit("byte getByteValue();");
- emit("void setByteValue(byte b);");
+ switch (bits) {
+ case SchemaType.SIZE_BIG_INTEGER:
+ emit("java.math.BigInteger getBigIntegerValue();", BeanMethod.GET);
+ emit("void setBigIntegerValue(java.math.BigInteger bi);", BeanMethod.SET);
+ break;
+ case SchemaType.SIZE_LONG:
+ emit("long getLongValue();", BeanMethod.GET);
+ emit("void setLongValue(long l);", BeanMethod.SET);
+ break;
+ case SchemaType.SIZE_INT:
+ emit("int getIntValue();", BeanMethod.GET);
+ emit("void setIntValue(int i);", BeanMethod.SET);
+ break;
+ case SchemaType.SIZE_SHORT:
+ emit("short getShortValue();", BeanMethod.GET);
+ emit("void setShortValue(short s);", BeanMethod.SET);
+ break;
+ case SchemaType.SIZE_BYTE:
+ emit("byte getByteValue();", BeanMethod.GET);
+ emit("void setByteValue(byte b);", BeanMethod.SET);
+ break;
}
}
}
if (sType.getSimpleVariety() == SchemaType.UNION) {
- emit("java.lang.Object getObjectValue();");
- emit("void setObjectValue(java.lang.Object val);");
- emit("org.apache.xmlbeans.SchemaType instanceType();");
+ emit("java.lang.Object getObjectValue();", BeanMethod.GET);
+ emit("void setObjectValue(java.lang.Object val);", BeanMethod.SET);
+ emit("org.apache.xmlbeans.SchemaType instanceType();", BeanMethod.INSTANCE_TYPE);
SchemaType ctype = sType.getUnionCommonBaseType();
if (ctype != null && ctype.getSimpleVariety() != SchemaType.UNION) {
emitSpecializedAccessors(ctype);
@@ -591,9 +455,9 @@
}
if (sType.getSimpleVariety() == SchemaType.LIST) {
- emit("java.util.List getListValue();");
- emit("java.util.List xgetListValue();");
- emit("void setListValue(java.util.List<?> list);");
+ emit("java.util.List getListValue();", BeanMethod.GET_LIST);
+ emit("java.util.List xgetListValue();", BeanMethod.XGET_LIST);
+ emit("void setListValue(java.util.List<?> list);", BeanMethod.SET_LIST);
}
}
@@ -607,6 +471,13 @@
emit("}");
}
+ void printJavaDoc(String sentence, BeanMethod method) throws IOException {
+ Set<BeanMethod> partMet = opt == null ? null : opt.getCompilePartialMethod();
+ if ((partMet == null || partMet.contains(method))) {
+ printJavaDoc(sentence);
+ }
+ }
+
void printJavaDoc(String sentence) throws IOException {
emit("");
emit("/**");
@@ -660,8 +531,8 @@
if (!hasBase) {
emit("");
- emit("org.apache.xmlbeans.StringEnumAbstractBase getEnumValue();");
- emit("void setEnumValue(org.apache.xmlbeans.StringEnumAbstractBase e);");
+ emit("org.apache.xmlbeans.StringEnumAbstractBase getEnumValue();", BeanMethod.GET);
+ emit("void setEnumValue(org.apache.xmlbeans.StringEnumAbstractBase e);", BeanMethod.SET);
}
emit("");
@@ -885,33 +756,35 @@
}
}
- void printPropertyGetters(QName qName, boolean isAttr,
- String propertyName, int javaType,
- String type, String xtype,
- boolean nillable, boolean optional,
- boolean several, boolean singleton)
- throws IOException {
- String propdesc = "\"" + qName.getLocalPart() + "\"" + (isAttr ? " attribute" : " element");
+ void printPropertyGetters(SchemaProperty prop) throws IOException {
+ String propertyName = prop.getJavaPropertyName();
+ int javaType = prop.getJavaTypeCode();
+ String type = javaTypeForProperty(prop);
+ String xtype = xmlTypeForProperty(prop);
+ boolean nillable = prop.hasNillable() != SchemaProperty.NEVER;
+ boolean several = prop.extendsJavaArray();
+
+ String propdesc = "\"" + prop.getName().getLocalPart() + "\"" + (prop.isAttribute() ? " attribute" : " element");
boolean xmltype = (javaType == SchemaProperty.XML_OBJECT);
- if (singleton) {
- printJavaDoc((several ? "Gets first " : "Gets the ") + propdesc);
- emit(type + " get" + propertyName + "();");
+ if (prop.extendsJavaSingleton()) {
+ printJavaDoc((several ? "Gets first " : "Gets the ") + propdesc, BeanMethod.GET);
+ emit(type + " get" + propertyName + "();", BeanMethod.GET);
if (!xmltype) {
- printJavaDoc((several ? "Gets (as xml) first " : "Gets (as xml) the ") + propdesc);
- emit(xtype + " xget" + propertyName + "();");
+ printJavaDoc((several ? "Gets (as xml) first " : "Gets (as xml) the ") + propdesc, BeanMethod.XGET);
+ emit(xtype + " xget" + propertyName + "();", BeanMethod.XGET);
}
if (nillable) {
- printJavaDoc((several ? "Tests for nil first " : "Tests for nil ") + propdesc);
- emit("boolean isNil" + propertyName + "();");
+ printJavaDoc((several ? "Tests for nil first " : "Tests for nil ") + propdesc, BeanMethod.IS_NIL);
+ emit("boolean isNil" + propertyName + "();", BeanMethod.IS_NIL);
}
}
- if (optional) {
- printJavaDoc((several ? "True if has at least one " : "True if has ") + propdesc);
- emit("boolean isSet" + propertyName + "();");
+ if (prop.extendsJavaOption()) {
+ printJavaDoc((several ? "True if has at least one " : "True if has ") + propdesc, BeanMethod.IS_SET);
+ emit("boolean isSet" + propertyName + "();", BeanMethod.IS_SET);
}
if (several) {
@@ -922,41 +795,48 @@
wrappedType = javaWrappedType(javaType);
}
- printJavaDoc("Gets a List of " + propdesc + "s");
- emit("java.util.List<" + wrappedType + "> get" + propertyName + "List();");
+ printJavaDoc("Gets a List of " + propdesc + "s", BeanMethod.GET_LIST);
+ emit("java.util.List<" + wrappedType + "> get" + propertyName + "List();", BeanMethod.GET_LIST);
- printJavaDoc("Gets array of all " + propdesc + "s");
- emit(type + "[] get" + arrayName + "();");
+ printJavaDoc("Gets array of all " + propdesc + "s", BeanMethod.GET_ARRAY);
+ emit(type + "[] get" + arrayName + "();", BeanMethod.GET_ARRAY);
- printJavaDoc("Gets ith " + propdesc);
- emit(type + " get" + arrayName + "(int i);");
+ printJavaDoc("Gets ith " + propdesc, BeanMethod.GET_IDX);
+ emit(type + " get" + arrayName + "(int i);", BeanMethod.GET_IDX);
if (!xmltype) {
- printJavaDoc("Gets (as xml) a List of " + propdesc + "s");
- emit("java.util.List<" + xtype + "> xget" + propertyName + "List();");
+ printJavaDoc("Gets (as xml) a List of " + propdesc + "s", BeanMethod.XGET_LIST);
+ emit("java.util.List<" + xtype + "> xget" + propertyName + "List();", BeanMethod.XGET_LIST);
- printJavaDoc("Gets (as xml) array of all " + propdesc + "s");
- emit(xtype + "[] xget" + arrayName + "();");
+ printJavaDoc("Gets (as xml) array of all " + propdesc + "s", BeanMethod.XGET_ARRAY);
+ emit(xtype + "[] xget" + arrayName + "();", BeanMethod.XGET_ARRAY);
- printJavaDoc("Gets (as xml) ith " + propdesc);
- emit(xtype + " xget" + arrayName + "(int i);");
+ printJavaDoc("Gets (as xml) ith " + propdesc, BeanMethod.XGET_IDX);
+ emit(xtype + " xget" + arrayName + "(int i);", BeanMethod.XGET_IDX);
}
if (nillable) {
- printJavaDoc("Tests for nil ith " + propdesc);
- emit("boolean isNil" + arrayName + "(int i);");
+ printJavaDoc("Tests for nil ith " + propdesc, BeanMethod.IS_NIL_IDX);
+ emit("boolean isNil" + arrayName + "(int i);", BeanMethod.IS_NIL_IDX);
}
- printJavaDoc("Returns number of " + propdesc);
- emit("int sizeOf" + arrayName + "();");
+ printJavaDoc("Returns number of " + propdesc, BeanMethod.SIZE_OF_ARRAY);
+ emit("int sizeOf" + arrayName + "();", BeanMethod.SIZE_OF_ARRAY);
}
}
- void printPropertySetters(QName qName, boolean isAttr,
- String propertyName, int javaType, String type, String xtype,
- boolean nillable, boolean optional,
- boolean several, boolean singleton)
- throws IOException {
+ void printPropertySetters(SchemaProperty prop) throws IOException {
+ QName qName = prop.getName();
+ boolean isAttr = prop.isAttribute();
+ String propertyName = prop.getJavaPropertyName();
+ int javaType = prop.getJavaTypeCode();
+ String type = javaTypeForProperty(prop);
+ String xtype = xmlTypeForProperty(prop);
+ boolean nillable = prop.hasNillable() != SchemaProperty.NEVER;
+ boolean optional = prop.extendsJavaOption();
+ boolean several = prop.extendsJavaArray();
+ boolean singleton = prop.extendsJavaSingleton();
+
String safeVarName = NameUtil.nonJavaKeyword(NameUtil.lowerCamelCase(propertyName));
if (safeVarName.equals("i")) {
safeVarName = "iValue";
@@ -966,68 +846,68 @@
String propdesc = "\"" + qName.getLocalPart() + "\"" + (isAttr ? " attribute" : " element");
if (singleton) {
- printJavaDoc((several ? "Sets first " : "Sets the ") + propdesc);
- emit("void set" + propertyName + "(" + type + " " + safeVarName + ");");
+ printJavaDoc((several ? "Sets first " : "Sets the ") + propdesc, BeanMethod.SET);
+ emit("void set" + propertyName + "(" + type + " " + safeVarName + ");", BeanMethod.SET);
if (!xmltype) {
- printJavaDoc((several ? "Sets (as xml) first " : "Sets (as xml) the ") + propdesc);
- emit("void xset" + propertyName + "(" + xtype + " " + safeVarName + ");");
+ printJavaDoc((several ? "Sets (as xml) first " : "Sets (as xml) the ") + propdesc, BeanMethod.XSET);
+ emit("void xset" + propertyName + "(" + xtype + " " + safeVarName + ");", BeanMethod.XSET);
}
if (xmltype && !several) {
- printJavaDoc("Appends and returns a new empty " + propdesc);
- emit(xtype + " addNew" + propertyName + "();");
+ printJavaDoc("Appends and returns a new empty " + propdesc, BeanMethod.ADD_NEW);
+ emit(xtype + " addNew" + propertyName + "();", BeanMethod.ADD_NEW);
}
if (nillable) {
- printJavaDoc((several ? "Nils the first " : "Nils the ") + propdesc);
- emit("void setNil" + propertyName + "();");
+ printJavaDoc((several ? "Nils the first " : "Nils the ") + propdesc, BeanMethod.SET_NIL);
+ emit("void setNil" + propertyName + "();", BeanMethod.SET_NIL);
}
}
if (optional) {
- printJavaDoc((several ? "Removes first " : "Unsets the ") + propdesc);
- emit("void unset" + propertyName + "();");
+ printJavaDoc((several ? "Removes first " : "Unsets the ") + propdesc, BeanMethod.UNSET);
+ emit("void unset" + propertyName + "();", BeanMethod.UNSET);
}
if (several) {
String arrayName = propertyName + "Array";
- printJavaDoc("Sets array of all " + propdesc);
- emit("void set" + arrayName + "(" + type + "[] " + safeVarName + "Array);");
+ printJavaDoc("Sets array of all " + propdesc, BeanMethod.SET_ARRAY);
+ emit("void set" + arrayName + "(" + type + "[] " + safeVarName + "Array);", BeanMethod.SET_ARRAY);
- printJavaDoc("Sets ith " + propdesc);
- emit("void set" + arrayName + "(int i, " + type + " " + safeVarName + ");");
+ printJavaDoc("Sets ith " + propdesc, BeanMethod.SET_IDX);
+ emit("void set" + arrayName + "(int i, " + type + " " + safeVarName + ");", BeanMethod.SET_IDX);
if (!xmltype) {
- printJavaDoc("Sets (as xml) array of all " + propdesc);
- emit("void xset" + arrayName + "(" + xtype + "[] " + safeVarName + "Array);");
+ printJavaDoc("Sets (as xml) array of all " + propdesc, BeanMethod.XSET_ARRAY);
+ emit("void xset" + arrayName + "(" + xtype + "[] " + safeVarName + "Array);", BeanMethod.XSET_ARRAY);
- printJavaDoc("Sets (as xml) ith " + propdesc);
- emit("void xset" + arrayName + "(int i, " + xtype + " " + safeVarName + ");");
+ printJavaDoc("Sets (as xml) ith " + propdesc, BeanMethod.XSET_IDX);
+ emit("void xset" + arrayName + "(int i, " + xtype + " " + safeVarName + ");", BeanMethod.XSET_IDX);
}
if (nillable) {
- printJavaDoc("Nils the ith " + propdesc);
- emit("void setNil" + arrayName + "(int i);");
+ printJavaDoc("Nils the ith " + propdesc, BeanMethod.SET_NIL_IDX);
+ emit("void setNil" + arrayName + "(int i);", BeanMethod.SET_NIL_IDX);
}
if (!xmltype) {
- printJavaDoc("Inserts the value as the ith " + propdesc);
- emit("void insert" + propertyName + "(int i, " + type + " " + safeVarName + ");");
+ printJavaDoc("Inserts the value as the ith " + propdesc, BeanMethod.INSERT_IDX);
+ emit("void insert" + propertyName + "(int i, " + type + " " + safeVarName + ");", BeanMethod.INSERT_IDX);
- printJavaDoc("Appends the value as the last " + propdesc);
- emit("void add" + propertyName + "(" + type + " " + safeVarName + ");");
+ printJavaDoc("Appends the value as the last " + propdesc, BeanMethod.ADD);
+ emit("void add" + propertyName + "(" + type + " " + safeVarName + ");", BeanMethod.ADD);
}
- printJavaDoc("Inserts and returns a new empty value (as xml) as the ith " + propdesc);
- emit(xtype + " insertNew" + propertyName + "(int i);");
+ printJavaDoc("Inserts and returns a new empty value (as xml) as the ith " + propdesc, BeanMethod.INSERT_NEW_IDX);
+ emit(xtype + " insertNew" + propertyName + "(int i);", BeanMethod.INSERT_NEW_IDX);
- printJavaDoc("Appends and returns a new empty value (as xml) as the last " + propdesc);
- emit(xtype + " addNew" + propertyName + "();");
+ printJavaDoc("Appends and returns a new empty value (as xml) as the last " + propdesc, BeanMethod.ADD_NEW);
+ emit(xtype + " addNew" + propertyName + "();", BeanMethod.ADD_NEW);
- printJavaDoc("Removes the ith " + propdesc);
- emit("void remove" + propertyName + "(int i);");
+ printJavaDoc("Removes the ith " + propdesc, BeanMethod.REMOVE_IDX);
+ emit("void remove" + propertyName + "(int i);", BeanMethod.REMOVE_IDX);
}
}
@@ -1219,332 +1099,331 @@
}
void printJGetArrayValue(int javaType, String type, SchemaTypeImpl stype, String setIdentifier) throws IOException {
+ String em;
switch (javaType) {
case SchemaProperty.XML_OBJECT:
- emit("return getXmlObjectArray(" + setIdentifier + ", new " + type + "[0]);");
+ em ="XmlObjectArray(#ID#, new " + type + "[0]);";
break;
case SchemaProperty.JAVA_ENUM:
- emit("return getEnumArray(" + setIdentifier + ", " + type + "[]::new);");
+ em = "EnumArray(#ID#, " + type + "[]::new);";
break;
case SchemaProperty.JAVA_BOOLEAN:
- emit("return getBooleanArray(" + setIdentifier + ");");
+ em = "BooleanArray(#ID#);";
break;
case SchemaProperty.JAVA_FLOAT:
- emit("return getFloatArray(" + setIdentifier + ");");
+ em = "FloatArray(#ID#);";
break;
case SchemaProperty.JAVA_DOUBLE:
- emit("return getDoubleArray(" + setIdentifier + ");");
+ em = "DoubleArray(#ID#);";
break;
case SchemaProperty.JAVA_BYTE:
- emit("return getByteArray(" + setIdentifier + ");");
+ em = "ByteArray(#ID#);";
break;
case SchemaProperty.JAVA_SHORT:
- emit("return getShortArray(" + setIdentifier + ");");
+ em = "ShortArray(#ID#);";
break;
case SchemaProperty.JAVA_INT:
- emit("return getIntArray(" + setIdentifier + ");");
+ em = "IntArray(#ID#);";
break;
case SchemaProperty.JAVA_LONG:
- emit("return getLongArray(" + setIdentifier + ");");
+ em = "LongArray(#ID#);";
break;
case SchemaProperty.JAVA_BIG_DECIMAL:
- emit("return getObjectArray(" + setIdentifier + ", org.apache.xmlbeans.SimpleValue::getBigDecimalValue, java.math.BigDecimal[]::new);");
+ em = "ObjectArray(#ID#, org.apache.xmlbeans.SimpleValue::getBigDecimalValue, java.math.BigDecimal[]::new);";
break;
case SchemaProperty.JAVA_BIG_INTEGER:
- emit("return getObjectArray(" + setIdentifier + ", org.apache.xmlbeans.SimpleValue::getBigIntegerValue, java.math.BigInteger[]::new);");
+ em = "ObjectArray(#ID#, org.apache.xmlbeans.SimpleValue::getBigIntegerValue, java.math.BigInteger[]::new);";
break;
case SchemaProperty.JAVA_STRING:
- emit("return getObjectArray(" + setIdentifier + ", org.apache.xmlbeans.SimpleValue::getStringValue, String[]::new);");
+ em = "ObjectArray(#ID#, org.apache.xmlbeans.SimpleValue::getStringValue, String[]::new);";
break;
case SchemaProperty.JAVA_BYTE_ARRAY:
- emit("return getObjectArray(" + setIdentifier + ", org.apache.xmlbeans.SimpleValue::getByteArrayValue, byte[][]::new);");
+ em = "ObjectArray(#ID#, org.apache.xmlbeans.SimpleValue::getByteArrayValue, byte[][]::new);";
break;
case SchemaProperty.JAVA_CALENDAR:
- emit("return getObjectArray(" + setIdentifier + ", org.apache.xmlbeans.SimpleValue::getCalendarValue, java.util.Calendar[]::new);");
+ em = "ObjectArray(#ID#, org.apache.xmlbeans.SimpleValue::getCalendarValue, java.util.Calendar[]::new);";
break;
case SchemaProperty.JAVA_DATE:
- emit("return getObjectArray(" + setIdentifier + ", org.apache.xmlbeans.SimpleValue::getDateValue, java.util.Date[]::new);");
+ em = "ObjectArray(#ID#, org.apache.xmlbeans.SimpleValue::getDateValue, java.util.Date[]::new);";
break;
case SchemaProperty.JAVA_GDATE:
- emit("return getObjectArray(" + setIdentifier + ", org.apache.xmlbeans.SimpleValue::getGDateValue, org.apache.xmlbeans.GDate[]::new);");
+ em = "ObjectArray(#ID#, org.apache.xmlbeans.SimpleValue::getGDateValue, org.apache.xmlbeans.GDate[]::new);";
break;
case SchemaProperty.JAVA_GDURATION:
- emit("return getObjectArray(" + setIdentifier + ", org.apache.xmlbeans.SimpleValue::getGDurationValue, org.apache.xmlbeans.GDuration[]::new);");
+ em = "ObjectArray(#ID#, org.apache.xmlbeans.SimpleValue::getGDurationValue, org.apache.xmlbeans.GDuration[]::new);";
break;
case SchemaProperty.JAVA_QNAME:
- emit("return getObjectArray(" + setIdentifier + ", org.apache.xmlbeans.SimpleValue::getQNameValue, javax.xml.namespace.QName[]::new);");
+ em = "ObjectArray(#ID#, org.apache.xmlbeans.SimpleValue::getQNameValue, javax.xml.namespace.QName[]::new);";
break;
case SchemaProperty.JAVA_LIST:
- emit("return getObjectArray(" + setIdentifier + ", org.apache.xmlbeans.SimpleValue::getListValue, java.util.List[]::new);");
+ em = "ObjectArray(#ID#, org.apache.xmlbeans.SimpleValue::getListValue, java.util.List[]::new);";
break;
case SchemaProperty.JAVA_OBJECT:
- emit("return getObjectArray(" + setIdentifier + ", org.apache.xmlbeans.SimpleValue::getObjectValue, java.util.Object[]::new);");
+ em = "ObjectArray(#ID#, org.apache.xmlbeans.SimpleValue::getObjectValue, java.util.Object[]::new);";
break;
case SchemaProperty.JAVA_USER:
// TOOD: replace lambda with method reference
- emit("return getObjectArray(" + setIdentifier + ", e -> " + getUserTypeStaticHandlerMethod(false, stype) + "(e), " + stype.getUserTypeName() + "[]::new);");
+ em = "ObjectArray(#ID#, e -> " + getUserTypeStaticHandlerMethod(false, stype) + "(e), " + stype.getUserTypeName() + "[]::new);";
break;
default:
throw new IllegalStateException();
}
+ emit("return get" +em.replace("#ID#", setIdentifier), BeanMethod.GET_ARRAY);
}
void printJGetValue(int javaType, String type, SchemaTypeImpl stype) throws IOException {
+ String em;
switch (javaType) {
case SchemaProperty.XML_OBJECT:
- emit("return target;");
+ em = "target";
break;
case SchemaProperty.JAVA_BOOLEAN:
- emit("return target.getBooleanValue();");
+ em = "target.getBooleanValue()";
break;
case SchemaProperty.JAVA_FLOAT:
- emit("return target.getFloatValue();");
+ em = "target.getFloatValue()";
break;
case SchemaProperty.JAVA_DOUBLE:
- emit("return target.getDoubleValue();");
+ em = "target.getDoubleValue()";
break;
case SchemaProperty.JAVA_BYTE:
- emit("return target.getByteValue();");
+ em = "target.getByteValue()";
break;
case SchemaProperty.JAVA_SHORT:
- emit("return target.getShortValue();");
+ em = "target.getShortValue()";
break;
case SchemaProperty.JAVA_INT:
- emit("return target.getIntValue();");
+ em = "target.getIntValue()";
break;
case SchemaProperty.JAVA_LONG:
- emit("return target.getLongValue();");
+ em = "target.getLongValue()";
break;
case SchemaProperty.JAVA_BIG_DECIMAL:
- emit("return target.getBigDecimalValue();");
+ em = "target.getBigDecimalValue()";
break;
case SchemaProperty.JAVA_BIG_INTEGER:
- emit("return target.getBigIntegerValue();");
+ em = "target.getBigIntegerValue()";
break;
case SchemaProperty.JAVA_STRING:
- emit("return target.getStringValue();");
+ em = "target.getStringValue()";
break;
case SchemaProperty.JAVA_BYTE_ARRAY:
- emit("return target.getByteArrayValue();");
+ em = "target.getByteArrayValue()";
break;
case SchemaProperty.JAVA_GDATE:
- emit("return target.getGDateValue();");
+ em = "target.getGDateValue()";
break;
case SchemaProperty.JAVA_GDURATION:
- emit("return target.getGDurationValue();");
+ em = "target.getGDurationValue()";
break;
case SchemaProperty.JAVA_CALENDAR:
- emit("return target.getCalendarValue();");
+ em = "target.getCalendarValue()";
break;
case SchemaProperty.JAVA_DATE:
- emit("return target.getDateValue();");
+ em = "target.getDateValue()";
break;
case SchemaProperty.JAVA_QNAME:
- emit("return target.getQNameValue();");
+ em = "target.getQNameValue()";
break;
case SchemaProperty.JAVA_LIST:
- emit("return target.getListValue();");
+ em = "target.getListValue()";
break;
case SchemaProperty.JAVA_ENUM:
- emit("return (" + type + ")target.getEnumValue();");
+ em = "(" + type + ")target.getEnumValue()";
break;
case SchemaProperty.JAVA_OBJECT:
- emit("return target.getObjectValue();");
+ em = "target.getObjectValue()";
break;
case SchemaProperty.JAVA_USER:
- emit("return " + getUserTypeStaticHandlerMethod(false, stype)
- + "(target);");
+ em = getUserTypeStaticHandlerMethod(false, stype) + "(target)";
break;
default:
throw new IllegalStateException();
}
+ emit("return " + em + ";");
}
void printJSetValue(int javaType, String safeVarName, SchemaTypeImpl stype) throws IOException {
+ String em;
switch (javaType) {
case SchemaProperty.XML_OBJECT:
- emit("target.set(" + safeVarName + ");");
+ em = "target.set(#VARNAME#)";
break;
case SchemaProperty.JAVA_BOOLEAN:
- emit("target.setBooleanValue(" + safeVarName + ");");
+ em = "target.setBooleanValue(#VARNAME#)";
break;
case SchemaProperty.JAVA_FLOAT:
- emit("target.setFloatValue(" + safeVarName + ");");
+ em = "target.setFloatValue(#VARNAME#)";
break;
case SchemaProperty.JAVA_DOUBLE:
- emit("target.setDoubleValue(" + safeVarName + ");");
+ em = "target.setDoubleValue(#VARNAME#)";
break;
case SchemaProperty.JAVA_BYTE:
- emit("target.setByteValue(" + safeVarName + ");");
+ em = "target.setByteValue(#VARNAME#)";
break;
case SchemaProperty.JAVA_SHORT:
- emit("target.setShortValue(" + safeVarName + ");");
+ em = "target.setShortValue(#VARNAME#)";
break;
case SchemaProperty.JAVA_INT:
- emit("target.setIntValue(" + safeVarName + ");");
+ em = "target.setIntValue(#VARNAME#)";
break;
case SchemaProperty.JAVA_LONG:
- emit("target.setLongValue(" + safeVarName + ");");
+ em = "target.setLongValue(#VARNAME#)";
break;
case SchemaProperty.JAVA_BIG_DECIMAL:
- emit("target.setBigDecimalValue(" + safeVarName + ");");
+ em = "target.setBigDecimalValue(#VARNAME#)";
break;
case SchemaProperty.JAVA_BIG_INTEGER:
- emit("target.setBigIntegerValue(" + safeVarName + ");");
+ em = "target.setBigIntegerValue(#VARNAME#)";
break;
case SchemaProperty.JAVA_STRING:
- emit("target.setStringValue(" + safeVarName + ");");
+ em = "target.setStringValue(#VARNAME#)";
break;
case SchemaProperty.JAVA_BYTE_ARRAY:
- emit("target.setByteArrayValue(" + safeVarName + ");");
+ em = "target.setByteArrayValue(#VARNAME#)";
break;
case SchemaProperty.JAVA_GDATE:
- emit("target.setGDateValue(" + safeVarName + ");");
+ em = "target.setGDateValue(#VARNAME#)";
break;
case SchemaProperty.JAVA_GDURATION:
- emit("target.setGDurationValue(" + safeVarName + ");");
+ em = "target.setGDurationValue(#VARNAME#)";
break;
case SchemaProperty.JAVA_CALENDAR:
- emit("target.setCalendarValue(" + safeVarName + ");");
+ em = "target.setCalendarValue(#VARNAME#)";
break;
case SchemaProperty.JAVA_DATE:
- emit("target.setDateValue(" + safeVarName + ");");
+ em = "target.setDateValue(#VARNAME#)";
break;
case SchemaProperty.JAVA_QNAME:
- emit("target.setQNameValue(" + safeVarName + ");");
+ em = "target.setQNameValue(#VARNAME#)";
break;
case SchemaProperty.JAVA_LIST:
- emit("target.setListValue(" + safeVarName + ");");
+ em = "target.setListValue(#VARNAME#)";
break;
case SchemaProperty.JAVA_ENUM:
- emit("target.setEnumValue(" + safeVarName + ");");
+ em = "target.setEnumValue(#VARNAME#)";
break;
case SchemaProperty.JAVA_OBJECT:
- emit("target.setObjectValue(" + safeVarName + ");");
+ em = "target.setObjectValue(#VARNAME#)";
break;
case SchemaProperty.JAVA_USER:
- emit(getUserTypeStaticHandlerMethod(true, stype)
- + "(" + safeVarName + ", target);");
+ em = getUserTypeStaticHandlerMethod(true, stype) + "(#VARNAME#, target)";
break;
default:
throw new IllegalStateException();
}
+ emit(em.replace("#VARNAME#", safeVarName) + ";");
}
- String getIdentifier(Map<QName, String[]> qNameMap, QName qName) {
- return qNameMap.get(qName)[0];
+ String getIdentifier(Map<QName, Integer> qnameMap, QName qName) {
+ return "PROPERTY_QNAME[" + qnameMap.get(qName) + "]";
}
- String getSetIdentifier(Map<QName, String[]> qNameMap, QName qName) {
- String[] identifiers = qNameMap.get(qName);
- return identifiers[1] == null ? identifiers[0] : identifiers[1];
+ String getSetIdentifier(Map<QName, Integer> qnameMap, QName qName, Map<QName, Integer> qsetMap) {
+ Integer ord = qsetMap.get(qName);
+ return ord == null ? getIdentifier(qnameMap, qName) : "PROPERTY_QSET["+ ord + "]";
}
- Map<QName, String[]> printStaticFields(SchemaProperty[] properties) throws IOException {
- final Map<QName, String[]> results = new HashMap<>();
+ void printStaticFields(SchemaProperty[] properties, Map<QName, Integer> qnameMap, Map<QName, Integer> qsetMap) throws IOException {
+ if (properties.length == 0) {
+ return;
+ }
+ int countQSet = 0;
emit("");
- for (int i = 0; i < properties.length; i++) {
- final String[] identifiers = new String[2];
- final SchemaProperty prop = properties[i];
+ emit("private static final QName[] PROPERTY_QNAME = {");
+ indent();
+ for (SchemaProperty prop : properties) {
final QName name = prop.getName();
- results.put(name, identifiers);
- final String javaName = prop.getJavaPropertyName();
- identifiers[0] = (javaName + "$" + (i * 2)).toUpperCase(Locale.ROOT);
- final String uriString = "\"" + name.getNamespaceURI() + "\"";
+ qnameMap.put(name, qnameMap.size());
+ emit("new QName(\"" + name.getNamespaceURI() + "\", \"" + name.getLocalPart() + "\"),");
+ countQSet = Math.max(countQSet, (prop.acceptedNames() == null ? 0 : prop.acceptedNames().length));
+ }
+ outdent();
+ emit("};");
+ emit("");
- emit("private static final javax.xml.namespace.QName " + identifiers[0] +
- " = ");
- indent();
- emit("new javax.xml.namespace.QName(" +
- uriString + ", \"" + name.getLocalPart() + "\");");
- outdent();
-
- if (properties[i].acceptedNames() != null) {
- final QName[] qnames = properties[i].acceptedNames();
-
- if (qnames.length > 1) {
- identifiers[1] = (javaName + "$" + (i * 2 + 1)).toUpperCase(Locale.ROOT);
-
- emit("private static final org.apache.xmlbeans.QNameSet " + identifiers[1] +
- " = org.apache.xmlbeans.QNameSet.forArray( new javax.xml.namespace.QName[] { ");
+ if (countQSet > 1) {
+ emit("private static final QNameSet[] PROPERTY_QSET = {");
+ for (SchemaProperty prop : properties) {
+ final QName name = prop.getName();
+ final QName[] qnames = prop.acceptedNames();
+ if (qnames != null && qnames.length > 1) {
+ qsetMap.put(name, qsetMap.size());
+ emit("QNameSet.forArray( new QName[] { ");
indent();
for (QName qname : qnames) {
- emit("new javax.xml.namespace.QName(\"" + qname.getNamespaceURI() +
- "\", \"" + qname.getLocalPart() + "\"),");
+ emit("new QName(\"" + qname.getNamespaceURI() + "\", \"" + qname.getLocalPart() + "\"),");
}
-
outdent();
-
- emit("});");
+ emit("}),");
}
}
+ emit("};");
}
- emit("");
- return results;
}
void emitImplementationPreamble() throws IOException {
@@ -1664,9 +1543,6 @@
emit("throw new IndexOutOfBoundsException();");
break;
- case NOTHING:
- break;
-
default:
assert false : "Bad behaviour type: " + nullBehaviour;
}
@@ -1674,123 +1550,110 @@
endBlock();
}
- void printListGetter15Impl(String parentJavaName,
- String propdesc, String propertyName,
- String wrappedType,
- boolean xmltype, boolean xget)
- throws IOException {
- String arrayName = propertyName + "Array";
- String listName = propertyName + "List";
- String parentThis = parentJavaName + ".this.";
+ void printListGetterImpl(String propdesc, String propertyName, String wrappedType, boolean xmltype, boolean xget)
+ throws IOException {
+ Set<BeanMethod> bmList = (opt == null) ? null : opt.getCompilePartialMethod();
+ if (bmList != null && !bmList.contains(xget ? BeanMethod.XGET_LIST : BeanMethod.GET_LIST)) {
+ return;
+ }
- String xgetMethod = (xget ? "x" : "") + "get";
- String xsetMethod = (xget ? "x" : "") + "set";
+ String arrayName = propertyName + "Array";
printJavaDoc("Gets " + (xget ? "(as xml) " : "") + "a List of " + propdesc + "s");
-
- emit("public java.util.List<" + wrappedType + "> " + xgetMethod + listName + "() {");
+ emit("@Override");
+ emit("public java.util.List<" + wrappedType + "> " + (xget ? "xget" : "get") + propertyName + "List() {");
startBlock();
- emit("final class " + listName + " extends java.util.AbstractList<" + wrappedType + "> {");
- startBlock();
-
- // Object get(i)
- emit("@Override");
- emit("public " + wrappedType + " get(int i)");
- emit(" { return " + parentThis + xgetMethod + arrayName + "(i); }");
- emit("");
-
- // Object set(i, o)
- emit("@Override");
- emit("public " + wrappedType + " set(int i, " + wrappedType + " o) {");
- startBlock();
- emit(wrappedType + " old = " + parentThis + xgetMethod + arrayName + "(i);");
- emit(parentThis + xsetMethod + arrayName + "(i, o);");
- emit("return old;");
- endBlock();
- emit("");
-
- // void add(i, o)
- emit("@Override");
- emit("public void add(int i, " + wrappedType + " o)");
- if (xmltype || xget) {
- emit(" { " + parentThis + "insertNew" + propertyName + "(i).set(o); }");
- } else {
- emit(" { " + parentThis + "insert" + propertyName + "(i, o); }");
- }
- emit("");
-
- // Object remove(i)
- emit("@Override");
- emit("public " + wrappedType + " remove(int i) {");
- startBlock();
- emit(wrappedType + " old = " + parentThis + xgetMethod + arrayName + "(i);");
- emit(parentThis + "remove" + propertyName + "(i);");
- emit("return old;");
- endBlock();
- emit("");
-
- // int size()
- emit("@Override");
- emit("public int size()");
- emit(" { return " + parentThis + "sizeOf" + arrayName + "(); }");
- emit("");
-
- endBlock();
-
- emit("");
-
emitImplementationPreamble();
- emit("return new " + listName + "();");
+ emit("return new org.apache.xmlbeans.impl.values.JavaList" + ((xmltype || xget) ? "Xml" : "") + "Object<>(");
+ indent();
+ if (bmList == null || bmList.contains(xget ? BeanMethod.XGET_IDX : BeanMethod.GET_IDX)) {
+ emit("this::" + (xget ? "xget" : "get") + arrayName + ",");
+ } else {
+ emit("null,");
+ }
+ if (bmList == null || bmList.contains(xget ? BeanMethod.XSET_IDX : BeanMethod.SET_IDX)) {
+ emit("this::" + (xget ? "xset" : "set") + arrayName + ",");
+ } else {
+ emit("null,");
+ }
+ if (bmList == null || bmList.contains((xmltype || xget) ? BeanMethod.INSERT_NEW_IDX : BeanMethod.INSERT_IDX)) {
+ emit("this::insert" + ((xmltype || xget) ? "New" : "") + propertyName + ",");
+ } else {
+ emit("null,");
+ }
+ if (bmList == null || bmList.contains(BeanMethod.REMOVE_IDX)) {
+ emit("this::remove" + propertyName + ",");
+ } else {
+ emit("null,");
+ }
+ if (bmList == null || bmList.contains(BeanMethod.SIZE_OF_ARRAY)) {
+ emit("this::sizeOf" + arrayName);
+ } else {
+ emit("null");
+ }
+ outdent();
+ emit(");");
emitImplementationPostamble();
endBlock();
}
- void printGetterImpls(String parentJavaName,
- SchemaProperty prop, QName qName, boolean isAttr, String propertyName,
- int javaType, String type, String xtype, boolean nillable,
- boolean optional, boolean several, boolean singleton,
- boolean isunion,
- String identifier, String setIdentifier)
- throws IOException {
+ void printGetterImpls(SchemaProperty prop, Map<QName, Integer> qnameMap, Map<QName, Integer> qsetMap)
+ throws IOException {
+ final QName qName = prop.getName();
+ final String identifier = getIdentifier(qnameMap, qName);
+ final String setIdentifier = getSetIdentifier(qnameMap, qName, qsetMap);
+ final boolean several = prop.extendsJavaArray();
+ final boolean nillable = prop.hasNillable() != SchemaProperty.NEVER;
+ final String type = javaTypeForProperty(prop);
+ final String xtype = xmlTypeForProperty(prop);
+ final int javaType = prop.getJavaTypeCode();
+ final boolean isAttr = prop.isAttribute();
+ final String propertyName = prop.getJavaPropertyName();
+
String propdesc = "\"" + qName.getLocalPart() + "\"" + (isAttr ? " attribute" : " element");
boolean xmltype = (javaType == SchemaProperty.XML_OBJECT);
- String jtargetType = (isunion || !xmltype) ? "org.apache.xmlbeans.SimpleValue" : xtype;
+ String jtargetType = (xmlTypeForPropertyIsUnion(prop) || !xmltype) ? "org.apache.xmlbeans.SimpleValue" : xtype;
- if (singleton) {
- // Value getProp()
- printJavaDoc((several ? "Gets first " : "Gets the ") + propdesc);
- emit("public " + type + " get" + propertyName + "() {");
- startBlock();
- emitImplementationPreamble();
+ Set<BeanMethod> bmList = (opt == null) ? null : opt.getCompilePartialMethod();
- emitGetTarget(setIdentifier, identifier, isAttr, "0", NOTHING, jtargetType);
- if (isAttr && (prop.hasDefault() == SchemaProperty.CONSISTENTLY ||
- prop.hasFixed() == SchemaProperty.CONSISTENTLY)) {
+ if (prop.extendsJavaSingleton()) {
+ if (bmList == null || bmList.contains(BeanMethod.GET)) {
+ // Value getProp()
+ printJavaDoc((several ? "Gets first " : "Gets the ") + propdesc);
+ emit("@Override");
+ emit("public " + type + " get" + propertyName + "() {");
+ startBlock();
+ emitImplementationPreamble();
+
+ emitGetTarget(setIdentifier, identifier, isAttr, "0", NOTHING, jtargetType);
+
+ if (isAttr && (prop.hasDefault() == SchemaProperty.CONSISTENTLY ||
+ prop.hasFixed() == SchemaProperty.CONSISTENTLY)) {
+ emit("if (target == null) {");
+ startBlock();
+ makeAttributeDefaultValue(jtargetType, prop, identifier);
+ endBlock();
+ }
emit("if (target == null) {");
startBlock();
- makeAttributeDefaultValue(jtargetType, prop, identifier);
+ makeMissingValue(javaType);
+ endBlock();
+
+ printJGetValue(javaType, type, (SchemaTypeImpl) prop.getType());
+
+ emitImplementationPostamble();
+
endBlock();
}
- emit("if (target == null) {");
- startBlock();
- makeMissingValue(javaType);
- endBlock();
-
- printJGetValue(javaType, type, (SchemaTypeImpl) prop.getType());
-
-
- emitImplementationPostamble();
-
- endBlock();
-
- if (!xmltype) {
+ if (!xmltype && (bmList == null || bmList.contains(BeanMethod.XGET))) {
// Value xgetProp()
printJavaDoc((several ? "Gets (as xml) first " : "Gets (as xml) the ") + propdesc);
+ emit("@Override");
emit("public " + xtype + " xget" + propertyName + "() {");
startBlock();
emitImplementationPreamble();
@@ -1809,9 +1672,10 @@
endBlock();
}
- if (nillable) {
+ if (nillable && (bmList == null || bmList.contains(BeanMethod.IS_NIL))) {
// boolean isNilProp()
printJavaDoc((several ? "Tests for nil first " : "Tests for nil ") + propdesc);
+ emit("@Override");
emit("public boolean isNil" + propertyName + "() {");
startBlock();
emitImplementationPreamble();
@@ -1824,9 +1688,10 @@
}
}
- if (optional) {
+ if (prop.extendsJavaOption() && (bmList == null || bmList.contains(BeanMethod.IS_SET))) {
// boolean isSetProp()
printJavaDoc((several ? "True if has at least one " : "True if has ") + propdesc);
+ emit("@Override");
emit("public boolean isSet" + propertyName + "() {");
startBlock();
@@ -1852,41 +1717,53 @@
wrappedType = javaWrappedType(javaType);
}
- printListGetter15Impl(parentJavaName, propdesc, propertyName, wrappedType, xmltype, false);
+ printListGetterImpl(propdesc, propertyName, wrappedType, xmltype, false);
- // Value[] getProp()
- printJavaDoc("Gets array of all " + propdesc + "s");
- emit("public " + type + "[] get" + arrayName + "() {");
- startBlock();
+ if (bmList == null || bmList.contains(BeanMethod.GET_ARRAY)) {
+ // Value[] getProp()
+ printJavaDoc("Gets array of all " + propdesc + "s");
+ emit("@Override");
+ emit("public " + type + "[] get" + arrayName + "() {");
+ startBlock();
- printJGetArrayValue(javaType, type, (SchemaTypeImpl) prop.getType(), setIdentifier);
+ printJGetArrayValue(javaType, type, (SchemaTypeImpl) prop.getType(), setIdentifier);
- endBlock();
+ endBlock();
+ }
- // Value getProp(int i)
- printJavaDoc("Gets ith " + propdesc);
- emit("public " + type + " get" + arrayName + "(int i) {");
- startBlock();
- emitImplementationPreamble();
+ if (bmList == null || bmList.contains(BeanMethod.GET_IDX)) {
+ // Value getProp(int i)
+ printJavaDoc("Gets ith " + propdesc);
+ emit("@Override");
+ emit("public " + type + " get" + arrayName + "(int i) {");
+ startBlock();
+ emitImplementationPreamble();
- emitGetTarget(setIdentifier, identifier, isAttr, "i", THROW_EXCEPTION, jtargetType);
- printJGetValue(javaType, type, (SchemaTypeImpl) prop.getType());
+ emitGetTarget(setIdentifier, identifier, isAttr, "i", THROW_EXCEPTION, jtargetType);
+ printJGetValue(javaType, type, (SchemaTypeImpl) prop.getType());
- emitImplementationPostamble();
- endBlock();
+ emitImplementationPostamble();
+ endBlock();
+ }
if (!xmltype) {
- printListGetter15Impl(parentJavaName, propdesc, propertyName, xtype, false, true);
+ printListGetterImpl(propdesc, propertyName, xtype, false, true);
+ }
+ if (!xmltype && (bmList == null || bmList.contains(BeanMethod.XGET_ARRAY))) {
// Value[] xgetProp()
printJavaDoc("Gets (as xml) array of all " + propdesc + "s");
+ emit("@Override");
emit("public " + xtype + "[] xget" + arrayName + "() {");
startBlock();
emit("return xgetArray(" + setIdentifier + ", " + xtype + "[]::new);");
endBlock();
+ }
+ if (!xmltype && (bmList == null || bmList.contains(BeanMethod.XGET_IDX))) {
// Value xgetProp(int i)
printJavaDoc("Gets (as xml) ith " + propdesc);
+ emit("@Override");
emit("public " + xtype + " xget" + arrayName + "(int i) {");
startBlock();
emitImplementationPreamble();
@@ -1894,12 +1771,12 @@
emit("return target;");
emitImplementationPostamble();
endBlock();
-
}
- if (nillable) {
+ if (nillable && (bmList == null || bmList.contains(BeanMethod.IS_NIL_IDX))) {
// boolean isNil(int i);
printJavaDoc("Tests for nil ith " + propdesc);
+ emit("@Override");
emit("public boolean isNil" + arrayName + "(int i) {");
startBlock();
emitImplementationPreamble();
@@ -1910,54 +1787,70 @@
}
// int countProp();
- printJavaDoc("Returns number of " + propdesc);
- emit("public int sizeOf" + arrayName + "() {");
- startBlock();
- emitImplementationPreamble();
- emit("return get_store().count_elements(" + setIdentifier + ");");
- emitImplementationPostamble();
- endBlock();
+ if (bmList == null || bmList.contains(BeanMethod.SIZE_OF_ARRAY)) {
+ printJavaDoc("Returns number of " + propdesc);
+ emit("@Override");
+ emit("public int sizeOf" + arrayName + "() {");
+ startBlock();
+ emitImplementationPreamble();
+ emit("return get_store().count_elements(" + setIdentifier + ");");
+ emitImplementationPostamble();
+ endBlock();
+ }
}
}
- void printSetterImpls(QName qName, SchemaProperty prop, boolean isAttr,
- String propertyName, int javaType, String type, String xtype,
- boolean nillable, boolean optional, boolean several, boolean singleton,
- boolean isunion, String identifier, String setIdentifier, SchemaType sType)
- throws IOException {
+ void printSetterImpls(SchemaProperty prop, Map<QName, Integer> qnameMap, Map<QName, Integer> qsetMap, SchemaType sType)
+ throws IOException {
+ final QName qName = prop.getName();
+ final String identifier = getIdentifier(qnameMap, qName);
+ final String setIdentifier = getSetIdentifier(qnameMap, qName, qsetMap);
+ final boolean several = prop.extendsJavaArray();
+ final boolean nillable = prop.hasNillable() != SchemaProperty.NEVER;
+ final String type = javaTypeForProperty(prop);
+ final String xtype = xmlTypeForProperty(prop);
+ final int javaType = prop.getJavaTypeCode();
+ final boolean isAttr = prop.isAttribute();
+ final String propertyName = prop.getJavaPropertyName();
+ Set<BeanMethod> bmList = (opt == null) ? null : opt.getCompilePartialMethod();
+
String safeVarName = NameUtil.nonJavaKeyword(NameUtil.lowerCamelCase(propertyName));
safeVarName = NameUtil.nonExtraKeyword(safeVarName);
boolean xmltype = (javaType == SchemaProperty.XML_OBJECT);
boolean isobj = (javaType == SchemaProperty.JAVA_OBJECT);
boolean isSubstGroup = !Objects.equals(identifier, setIdentifier);
- String jtargetType = (isunion || !xmltype) ? "org.apache.xmlbeans.SimpleValue" : xtype;
+ String jtargetType = (xmlTypeForPropertyIsUnion(prop) || !xmltype) ? "org.apache.xmlbeans.SimpleValue" : xtype;
String propdesc = "\"" + qName.getLocalPart() + "\"" + (isAttr ? " attribute" : " element");
- if (singleton) {
- // void setProp(Value v);
- printJavaDoc((several ? "Sets first " : "Sets the ") + propdesc);
- emit("public void set" + propertyName + "(" + type + " " + safeVarName + ") {");
- startBlock();
- if (xmltype && !isSubstGroup && !isAttr) {
- emitPre(sType, PrePostExtension.OPERATION_SET, identifier, false, several ? "0" : "-1");
- emit("generatedSetterHelperImpl(" + safeVarName + ", " + setIdentifier + ", 0, " +
- "org.apache.xmlbeans.impl.values.XmlObjectBase.KIND_SETTERHELPER_SINGLETON);");
- emitPost(sType, PrePostExtension.OPERATION_SET, identifier, false, several ? "0" : "-1");
- } else {
- emitImplementationPreamble();
- emitPre(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, several ? "0" : "-1");
- emitGetTarget(setIdentifier, identifier, isAttr, "0", ADD_NEW_VALUE, jtargetType);
- printJSetValue(javaType, safeVarName, (SchemaTypeImpl) prop.getType());
- emitPost(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, several ? "0" : "-1");
- emitImplementationPostamble();
+ if (prop.extendsJavaSingleton()) {
+ if (bmList == null || bmList.contains(BeanMethod.SET)) {
+ // void setProp(Value v);
+ printJavaDoc((several ? "Sets first " : "Sets the ") + propdesc);
+ emit("@Override");
+ emit("public void set" + propertyName + "(" + type + " " + safeVarName + ") {");
+ startBlock();
+ if (xmltype && !isSubstGroup && !isAttr) {
+ emitPre(sType, PrePostExtension.OPERATION_SET, identifier, false, several ? "0" : "-1");
+ emit("generatedSetterHelperImpl(" + safeVarName + ", " + setIdentifier + ", 0, " +
+ "org.apache.xmlbeans.impl.values.XmlObjectBase.KIND_SETTERHELPER_SINGLETON);");
+ emitPost(sType, PrePostExtension.OPERATION_SET, identifier, false, several ? "0" : "-1");
+ } else {
+ emitImplementationPreamble();
+ emitPre(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, several ? "0" : "-1");
+ emitGetTarget(setIdentifier, identifier, isAttr, "0", ADD_NEW_VALUE, jtargetType);
+ printJSetValue(javaType, safeVarName, (SchemaTypeImpl) prop.getType());
+ emitPost(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, several ? "0" : "-1");
+ emitImplementationPostamble();
+ }
+ endBlock();
}
- endBlock();
- if (!xmltype) {
+ if (!xmltype && (bmList == null || bmList.contains(BeanMethod.XSET))) {
// void xsetProp(Value v)
printJavaDoc((several ? "Sets (as xml) first " : "Sets (as xml) the ") + propdesc);
+ emit("@Override");
emit("public void xset" + propertyName + "(" + xtype + " " + safeVarName + ") {");
startBlock();
emitImplementationPreamble();
@@ -1970,9 +1863,10 @@
}
- if (xmltype && !several) {
+ if (xmltype && !several && (bmList == null || bmList.contains(BeanMethod.ADD_NEW))) {
// Value addNewProp()
printJavaDoc("Appends and returns a new empty " + propdesc);
+ emit("@Override");
emit("public " + xtype + " addNew" + propertyName + "() {");
startBlock();
emitImplementationPreamble();
@@ -1985,8 +1879,9 @@
endBlock();
}
- if (nillable) {
+ if (nillable && (bmList == null || bmList.contains(BeanMethod.SET_NIL))) {
printJavaDoc((several ? "Nils the first " : "Nils the ") + propdesc);
+ emit("@Override");
emit("public void setNil" + propertyName + "() {");
startBlock();
emitImplementationPreamble();
@@ -1999,8 +1894,9 @@
}
}
- if (optional) {
+ if (prop.extendsJavaOption() && (bmList == null || bmList.contains(BeanMethod.UNSET))) {
printJavaDoc((several ? "Removes first " : "Unsets the ") + propdesc);
+ emit("@Override");
emit("public void unset" + propertyName + "() {");
startBlock();
emitImplementationPreamble();
@@ -2018,92 +1914,100 @@
if (several) {
String arrayName = propertyName + "Array";
- if (xmltype) {
- printJavaDoc("Sets array of all " + propdesc + " WARNING: This method is not atomicaly synchronized.");
- emit("public void set" + arrayName + "(" + type + "[] " + safeVarName + "Array) {");
- startBlock();
- // do not use synchronize (monitor()) { and GlobalLock inside } !!! deadlock
- //emitImplementationPreamble();
- emit("check_orphaned();");
- emitPre(sType, PrePostExtension.OPERATION_SET, identifier, isAttr);
+ if (bmList == null || bmList.contains(BeanMethod.SET_ARRAY)) {
+ if (xmltype) {
+ printJavaDoc("Sets array of all " + propdesc + " WARNING: This method is not atomicaly synchronized.");
+ emit("@Override");
+ emit("public void set" + arrayName + "(" + type + "[] " + safeVarName + "Array) {");
+ startBlock();
+ // do not use synchronize (monitor()) { and GlobalLock inside } !!! deadlock
+ //emitImplementationPreamble();
+ emit("check_orphaned();");
+ emitPre(sType, PrePostExtension.OPERATION_SET, identifier, isAttr);
- if (isobj) {
- if (!isSubstGroup) {
- emit("unionArraySetterHelper(" + safeVarName + "Array" + ", " + identifier + ");");
+ if (isobj) {
+ if (!isSubstGroup) {
+ emit("unionArraySetterHelper(" + safeVarName + "Array" + ", " + identifier + ");");
+ } else {
+ emit("unionArraySetterHelper(" + safeVarName + "Array" + ", " + identifier + ", " + setIdentifier + ");");
+ }
} else {
- emit("unionArraySetterHelper(" + safeVarName + "Array" + ", " + identifier + ", " + setIdentifier + ");");
+ if (!isSubstGroup) {
+ emit("arraySetterHelper(" + safeVarName + "Array" + ", " + identifier + ");");
+ } else {
+ emit("arraySetterHelper(" + safeVarName + "Array" + ", " + identifier + ", " + setIdentifier + ");");
+ }
}
+
+ emitPost(sType, PrePostExtension.OPERATION_SET, identifier, isAttr);
+ //emitImplementationPostamble(); to avoid deadlock
+ endBlock();
} else {
- if (!isSubstGroup) {
- emit("arraySetterHelper(" + safeVarName + "Array" + ", " + identifier + ");");
- } else {
- emit("arraySetterHelper(" + safeVarName + "Array" + ", " + identifier + ", " + setIdentifier + ");");
- }
- }
+ printJavaDoc("Sets array of all " + propdesc);
+ emit("@Override");
+ emit("public void set" + arrayName + "(" + type + "[] " + safeVarName + "Array) {");
+ startBlock();
+ emitImplementationPreamble();
+ emitPre(sType, PrePostExtension.OPERATION_SET, identifier, isAttr);
- emitPost(sType, PrePostExtension.OPERATION_SET, identifier, isAttr);
- //emitImplementationPostamble(); to avoid deadlock
- endBlock();
- } else {
- printJavaDoc("Sets array of all " + propdesc);
- emit("public void set" + arrayName + "(" + type + "[] " + safeVarName + "Array) {");
+ if (isobj) {
+ if (!isSubstGroup) {
+ emit("unionArraySetterHelper(" + safeVarName + "Array" + ", " + identifier + ");");
+ } else {
+ emit("unionArraySetterHelper(" + safeVarName + "Array" + ", " + identifier + ", " + setIdentifier + ");");
+ }
+ } else if (prop.getJavaTypeCode() == SchemaProperty.JAVA_USER) {
+ if (!isSubstGroup) {
+ emit("org.apache.xmlbeans.SimpleValue[] dests = arraySetterHelper(" + safeVarName + "Array.length" + ", " + identifier + ");");
+ emit("for ( int i = 0 ; i < dests.length ; i++ ) {");
+ emit(" " + getUserTypeStaticHandlerMethod(true, (SchemaTypeImpl) prop.getType())
+ + "(" + safeVarName + "Array[i], dests[i]);");
+ emit("}");
+ } else {
+ emit("org.apache.xmlbeans.SimpleValue[] dests = arraySetterHelper(" + safeVarName + "Array.length" + ", " + identifier + ", " + setIdentifier + ");");
+ emit("for ( int i = 0 ; i < dests.length ; i++ ) {");
+ emit(" " + getUserTypeStaticHandlerMethod(true, (SchemaTypeImpl) prop.getType())
+ + "(" + safeVarName + "Array[i], dests[i]);");
+ emit("}");
+ }
+ } else {
+ if (!isSubstGroup) {
+ emit("arraySetterHelper(" + safeVarName + "Array" + ", " + identifier + ");");
+ } else {
+ emit("arraySetterHelper(" + safeVarName + "Array" + ", " + identifier + ", " + setIdentifier + ");");
+ }
+ }
+
+ emitPost(sType, PrePostExtension.OPERATION_SET, identifier, isAttr);
+ emitImplementationPostamble();
+ endBlock();
+ }
+ }
+
+ if (bmList == null || bmList.contains(BeanMethod.SET_IDX)) {
+ printJavaDoc("Sets ith " + propdesc);
+ emit("@Override");
+ emit("public void set" + arrayName + "(int i, " + type + " " + safeVarName + ") {");
startBlock();
- emitImplementationPreamble();
- emitPre(sType, PrePostExtension.OPERATION_SET, identifier, isAttr);
-
- if (isobj) {
- if (!isSubstGroup) {
- emit("unionArraySetterHelper(" + safeVarName + "Array" + ", " + identifier + ");");
- } else {
- emit("unionArraySetterHelper(" + safeVarName + "Array" + ", " + identifier + ", " + setIdentifier + ");");
- }
- } else if (prop.getJavaTypeCode() == SchemaProperty.JAVA_USER) {
- if (!isSubstGroup) {
- emit("org.apache.xmlbeans.SimpleValue[] dests = arraySetterHelper(" + safeVarName + "Array.length" + ", " + identifier + ");");
- emit("for ( int i = 0 ; i < dests.length ; i++ ) {");
- emit(" " + getUserTypeStaticHandlerMethod(true, (SchemaTypeImpl) prop.getType())
- + "(" + safeVarName + "Array[i], dests[i]);");
- emit("}");
- } else {
- emit("org.apache.xmlbeans.SimpleValue[] dests = arraySetterHelper(" + safeVarName + "Array.length" + ", " + identifier + ", " + setIdentifier + ");");
- emit("for ( int i = 0 ; i < dests.length ; i++ ) {");
- emit(" " + getUserTypeStaticHandlerMethod(true, (SchemaTypeImpl) prop.getType())
- + "(" + safeVarName + "Array[i], dests[i]);");
- emit("}");
- }
+ if (xmltype && !isSubstGroup) {
+ emitPre(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, "i");
+ emit("generatedSetterHelperImpl(" + safeVarName + ", " + setIdentifier + ", i, " +
+ "org.apache.xmlbeans.impl.values.XmlObjectBase.KIND_SETTERHELPER_ARRAYITEM);");
+ emitPost(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, "i");
} else {
- if (!isSubstGroup) {
- emit("arraySetterHelper(" + safeVarName + "Array" + ", " + identifier + ");");
- } else {
- emit("arraySetterHelper(" + safeVarName + "Array" + ", " + identifier + ", " + setIdentifier + ");");
- }
+ emitImplementationPreamble();
+ emitPre(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, "i");
+ emitGetTarget(setIdentifier, identifier, isAttr, "i", THROW_EXCEPTION, jtargetType);
+ printJSetValue(javaType, safeVarName, (SchemaTypeImpl) prop.getType());
+ emitPost(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, "i");
+ emitImplementationPostamble();
}
-
- emitPost(sType, PrePostExtension.OPERATION_SET, identifier, isAttr);
- emitImplementationPostamble();
endBlock();
}
- printJavaDoc("Sets ith " + propdesc);
- emit("public void set" + arrayName + "(int i, " + type + " " + safeVarName + ") {");
- startBlock();
- if (xmltype && !isSubstGroup) {
- emitPre(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, "i");
- emit("generatedSetterHelperImpl(" + safeVarName + ", " + setIdentifier + ", i, " +
- "org.apache.xmlbeans.impl.values.XmlObjectBase.KIND_SETTERHELPER_ARRAYITEM);");
- emitPost(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, "i");
- } else {
- emitImplementationPreamble();
- emitPre(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, "i");
- emitGetTarget(setIdentifier, identifier, isAttr, "i", THROW_EXCEPTION, jtargetType);
- printJSetValue(javaType, safeVarName, (SchemaTypeImpl) prop.getType());
- emitPost(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, "i");
- emitImplementationPostamble();
- }
- endBlock();
-
- if (!xmltype) {
+ if (!xmltype && (bmList == null || bmList.contains(BeanMethod.XSET_ARRAY))) {
printJavaDoc("Sets (as xml) array of all " + propdesc);
+ emit("@Override");
emit("public void xset" + arrayName + "(" + xtype + "[]" + safeVarName + "Array) {");
startBlock();
emitImplementationPreamble();
@@ -2112,8 +2016,11 @@
emitPost(sType, PrePostExtension.OPERATION_SET, identifier, isAttr);
emitImplementationPostamble();
endBlock();
+ }
+ if (!xmltype && (bmList == null || bmList.contains(BeanMethod.XSET_IDX))) {
printJavaDoc("Sets (as xml) ith " + propdesc);
+ emit("@Override");
emit("public void xset" + arrayName + "(int i, " + xtype + " " + safeVarName + ") {");
startBlock();
emitImplementationPreamble();
@@ -2125,8 +2032,9 @@
endBlock();
}
- if (nillable) {
+ if (nillable && (bmList == null || bmList.contains(BeanMethod.SET_NIL_IDX))) {
printJavaDoc("Nils the ith " + propdesc);
+ emit("@Override");
emit("public void setNil" + arrayName + "(int i) {");
startBlock();
emitImplementationPreamble();
@@ -2138,8 +2046,9 @@
endBlock();
}
- if (!xmltype) {
+ if (!xmltype && (bmList == null || bmList.contains(BeanMethod.INSERT_IDX))) {
printJavaDoc("Inserts the value as the ith " + propdesc);
+ emit("@Override");
emit("public void insert" + propertyName + "(int i, " + type + " " + safeVarName + ") {");
startBlock();
emitImplementationPreamble();
@@ -2158,8 +2067,11 @@
emitPost(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr, "i");
emitImplementationPostamble();
endBlock();
+ }
+ if (!xmltype && (bmList == null || bmList.contains(BeanMethod.ADD))) {
printJavaDoc("Appends the value as the last " + propdesc);
+ emit("@Override");
emit("public void add" + propertyName + "(" + type + " " + safeVarName + ") {");
startBlock();
emitImplementationPreamble();
@@ -2172,48 +2084,94 @@
endBlock();
}
- printJavaDoc("Inserts and returns a new empty value (as xml) as the ith " + propdesc);
- emit("public " + xtype + " insertNew" + propertyName + "(int i) {");
- startBlock();
- emitImplementationPreamble();
- emit(xtype + " target = null;");
- emitPre(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr, "i");
- if (!isSubstGroup) {
- emit("target = (" + xtype + ")get_store().insert_element_user(" + identifier + ", i);");
- } else // This is a subst group case
- {
- emit("target = (" + xtype + ")get_store().insert_element_user(" +
- setIdentifier + ", " + identifier + ", i);");
+ if (bmList == null || bmList.contains(BeanMethod.INSERT_NEW_IDX)) {
+ printJavaDoc("Inserts and returns a new empty value (as xml) as the ith " + propdesc);
+ emit("@Override");
+ emit("public " + xtype + " insertNew" + propertyName + "(int i) {");
+ startBlock();
+ emitImplementationPreamble();
+ emit(xtype + " target = null;");
+ emitPre(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr, "i");
+ if (!isSubstGroup) {
+ emit("target = (" + xtype + ")get_store().insert_element_user(" + identifier + ", i);");
+ } else // This is a subst group case
+ {
+ emit("target = (" + xtype + ")get_store().insert_element_user(" +
+ setIdentifier + ", " + identifier + ", i);");
+ }
+ emitPost(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr, "i");
+ emit("return target;");
+ emitImplementationPostamble();
+ endBlock();
}
- emitPost(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr, "i");
- emit("return target;");
- emitImplementationPostamble();
- endBlock();
- printJavaDoc("Appends and returns a new empty value (as xml) as the last " + propdesc);
- emit("public " + xtype + " addNew" + propertyName + "() {");
- startBlock();
- emitImplementationPreamble();
- emit(xtype + " target = null;");
- emitPre(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr);
- emitAddTarget(identifier, isAttr, xtype);
- emitPost(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr);
- emit("return target;");
- emitImplementationPostamble();
- endBlock();
+ if (bmList == null || bmList.contains(BeanMethod.ADD_NEW)) {
+ printJavaDoc("Appends and returns a new empty value (as xml) as the last " + propdesc);
+ emit("@Override");
+ emit("public " + xtype + " addNew" + propertyName + "() {");
+ startBlock();
+ emitImplementationPreamble();
+ emit(xtype + " target = null;");
+ emitPre(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr);
+ emitAddTarget(identifier, isAttr, xtype);
+ emitPost(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr);
+ emit("return target;");
+ emitImplementationPostamble();
+ endBlock();
+ }
- printJavaDoc("Removes the ith " + propdesc);
- emit("public void remove" + propertyName + "(int i) {");
- startBlock();
- emitImplementationPreamble();
- emitPre(sType, PrePostExtension.OPERATION_REMOVE, identifier, isAttr, "i");
- emit("get_store().remove_element(" + setIdentifier + ", i);");
- emitPost(sType, PrePostExtension.OPERATION_REMOVE, identifier, isAttr, "i");
- emitImplementationPostamble();
- endBlock();
+ if (bmList == null || bmList.contains(BeanMethod.REMOVE_IDX)) {
+ printJavaDoc("Removes the ith " + propdesc);
+ emit("@Override");
+ emit("public void remove" + propertyName + "(int i) {");
+ startBlock();
+ emitImplementationPreamble();
+ emitPre(sType, PrePostExtension.OPERATION_REMOVE, identifier, isAttr, "i");
+ emit("get_store().remove_element(" + setIdentifier + ", i);");
+ emitPost(sType, PrePostExtension.OPERATION_REMOVE, identifier, isAttr, "i");
+ emitImplementationPostamble();
+ endBlock();
+ }
}
}
+ SchemaProperty[] getSchemaProperties(SchemaType sType) {
+ if (sType.getContentType() != SchemaType.SIMPLE_CONTENT) {
+ // complex content type implementations derive from base type impls
+ // so derived property impls can be reused
+ return getDerivedProperties(sType);
+ }
+
+ // simple content types impls derive directly from "holder" impls
+ // in order to handle the case (for ints or string enums e.g.) where
+ // there is a simple type restriction. So property getters need to
+ // be implemented "from scratch" for each derived complex type
+ // Moreover, attribute or element properties can be removed via restriction,
+ // but we still need to implement them because this class is supposed to
+ // also implement all the interfaces
+ SchemaType baseType = sType.getBaseType();
+ List<SchemaProperty> extraProperties = null;
+ while (!baseType.isSimpleType() && !baseType.isBuiltinType()) {
+ for (SchemaProperty baseProperty : baseType.getDerivedProperties()) {
+ if (!(baseProperty.isAttribute() && sType.getAttributeProperty(baseProperty.getName()) != null)) {
+ if (extraProperties == null) {
+ extraProperties = new ArrayList<>();
+ }
+ extraProperties.add(baseProperty);
+ }
+ }
+ baseType = baseType.getBaseType();
+ }
+
+ SchemaProperty[] properties = sType.getProperties();
+ if (extraProperties == null) {
+ return properties;
+ }
+
+ Collections.addAll(extraProperties, properties);
+ return extraProperties.toArray(new SchemaProperty[0]);
+ }
+
void printInnerTypeImpl(
SchemaType sType, SchemaTypeSystem system, boolean isInner) throws IOException {
String shortName = sType.getShortJavaImplName();
@@ -2227,86 +2185,16 @@
printExtensionImplMethods(sType);
if (!sType.isSimpleType()) {
- SchemaProperty[] properties;
-
- if (sType.getContentType() == SchemaType.SIMPLE_CONTENT) {
- // simple content types impls derive directly from "holder" impls
- // in order to handle the case (for ints or string enums e.g.) where
- // there is a simple type restriction. So property getters need to
- // be implemented "from scratch" for each derived complex type
- // Moreover, attribute or element properties can be removed via restriction,
- // but we still need to implement them because this class is supposed to
- // also implement all the interfaces
- SchemaType baseType = sType.getBaseType();
- List<SchemaProperty> extraProperties = null;
- while (!baseType.isSimpleType() && !baseType.isBuiltinType()) {
- SchemaProperty[] baseProperties = baseType.getDerivedProperties();
- for (SchemaProperty baseProperty : baseProperties) {
- if (!(baseProperty.isAttribute() &&
- sType.getAttributeProperty(baseProperty.getName()) != null)) {
- if (extraProperties == null) {
- extraProperties = new ArrayList<>();
- }
- extraProperties.add(baseProperty);
- }
- }
- baseType = baseType.getBaseType();
- }
-
- properties = sType.getProperties();
- if (extraProperties != null) {
- Collections.addAll(extraProperties, properties);
- properties = extraProperties.toArray(new SchemaProperty[0]);
- }
- } else {
- // complex content type implementations derive from base type impls
- // so derived property impls can be reused
-
- properties = getDerivedProperties(sType);
- }
-
- Map<QName, String[]> qNameMap = printStaticFields(properties);
+ SchemaProperty[] properties = getSchemaProperties(sType);
+ Map<QName, Integer> qnameMap = new HashMap<>();
+ Map<QName, Integer> qsetMap = new HashMap<>();
+ printStaticFields(properties, qnameMap, qsetMap);
for (SchemaProperty prop : properties) {
- QName name = prop.getName();
- String xmlType = xmlTypeForProperty(prop);
-
- printGetterImpls(
- shortName,
- prop,
- name,
- prop.isAttribute(),
- prop.getJavaPropertyName(),
- prop.getJavaTypeCode(),
- javaTypeForProperty(prop),
- xmlType,
- prop.hasNillable() != SchemaProperty.NEVER,
- prop.extendsJavaOption(),
- prop.extendsJavaArray(),
- prop.extendsJavaSingleton(),
- xmlTypeForPropertyIsUnion(prop),
- getIdentifier(qNameMap, name),
- getSetIdentifier(qNameMap, name)
- );
+ printGetterImpls(prop, qnameMap, qsetMap);
if (!prop.isReadOnly()) {
- printSetterImpls(
- name,
- prop,
- prop.isAttribute(),
- prop.getJavaPropertyName(),
- prop.getJavaTypeCode(),
- javaTypeForProperty(prop),
- xmlType,
- prop.hasNillable() != SchemaProperty.NEVER,
- prop.extendsJavaOption(),
- prop.extendsJavaArray(),
- prop.extendsJavaSingleton(),
- xmlTypeForPropertyIsUnion(prop),
- getIdentifier(qNameMap, name),
- getSetIdentifier(qNameMap, name),
- sType
- );
+ printSetterImpls(prop, qnameMap, qsetMap, sType);
}
}
}
diff --git a/src/main/java/org/apache/xmlbeans/impl/schema/SchemaTypeSystemCompiler.java b/src/main/java/org/apache/xmlbeans/impl/schema/SchemaTypeSystemCompiler.java
index 3a512be..66748c6 100644
--- a/src/main/java/org/apache/xmlbeans/impl/schema/SchemaTypeSystemCompiler.java
+++ b/src/main/java/org/apache/xmlbeans/impl/schema/SchemaTypeSystemCompiler.java
@@ -380,9 +380,14 @@
String fjn = type.getFullJavaName();
+ SchemaCodePrinter printer = (options == null) ? null : options.getSchemaCodePrinter();
+ if (printer == null) {
+ printer = new SchemaTypeCodePrinter();
+ }
+
try (Writer writer = filer.createSourceFile(fjn)) {
// Generate interface class
- SchemaTypeCodePrinter.printType(writer, type, options);
+ printer.printType(writer, type, options);
} catch (IOException e) {
System.err.println("IO Error " + e);
success = false;
@@ -392,7 +397,7 @@
try (Writer writer = filer.createSourceFile(fjn)) {
// Generate Implementation class
- SchemaTypeCodePrinter.printTypeImpl(writer, type, options);
+ printer.printTypeImpl(writer, type, options);
} catch (IOException e) {
System.err.println("IO Error " + e);
success = false;
diff --git a/src/main/java/org/apache/xmlbeans/impl/schema/SimpleTypeFactory.java b/src/main/java/org/apache/xmlbeans/impl/schema/SimpleTypeFactory.java
new file mode 100644
index 0000000..51d8814
--- /dev/null
+++ b/src/main/java/org/apache/xmlbeans/impl/schema/SimpleTypeFactory.java
@@ -0,0 +1,29 @@
+/* Copyright 2017, 2018 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xmlbeans.impl.schema;
+
+import org.apache.xmlbeans.SchemaTypeSystem;
+
+@SuppressWarnings("unchecked")
+public class SimpleTypeFactory<T> extends ElementFactory<T> {
+ public SimpleTypeFactory(SchemaTypeSystem typeSystem, String typeHandle) {
+ super(typeSystem, typeHandle);
+ }
+
+ public T newValue(java.lang.Object obj) {
+ return (T) getType().newValue(obj);
+ }
+}
diff --git a/src/main/java/org/apache/xmlbeans/impl/schema/XmlObjectFactory.java b/src/main/java/org/apache/xmlbeans/impl/schema/XmlObjectFactory.java
new file mode 100644
index 0000000..9fe396c
--- /dev/null
+++ b/src/main/java/org/apache/xmlbeans/impl/schema/XmlObjectFactory.java
@@ -0,0 +1,332 @@
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xmlbeans.impl.schema;
+
+import org.apache.xmlbeans.*;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Node;
+
+import javax.xml.stream.XMLStreamReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+
+/**
+ * Factory class for creating new instances. Note that if
+ * a type can be inferred from the XML being loaded (for example,
+ * by recognizing the document element QName), then the instance
+ * returned by a factory will have the inferred type. Otherwise
+ * the Factory will returned an untyped document.
+ */
+@SuppressWarnings("unchecked")
+public class XmlObjectFactory<T> extends DocumentFactory<T> {
+ // anytype needs to be handled different while parsing - opposed to specific instances
+ private final boolean isAnyType;
+
+ public XmlObjectFactory(String typeHandle) {
+ this(XmlBeans.getBuiltinTypeSystem(), typeHandle);
+ }
+
+ /**
+ * This constructor is only used as a workaround for bootstrapping the XML schemas - don't use it!
+ */
+ public XmlObjectFactory(SchemaTypeSystem typeSystem, String typeHandle) {
+ super(typeSystem, typeHandle);
+ isAnyType = "_BI_anyType".equals(typeHandle);
+ }
+
+ /**
+ * Creates a new, completely empty instance.
+ */
+ @Override
+ public T newInstance() {
+ return (T)XmlBeans.getContextTypeLoader().newInstance(getInnerType(), null);
+ }
+
+ /**
+ * <p>Creates a new, completely empty instance, specifying options
+ * for the root element's document type and/or whether to validate
+ * value facets as they are set.</p>
+ * <p>
+ * Use the <em>options</em> parameter to specify the following:</p>
+ *
+ * <table>
+ * <tr><th>To specify this</th><th>Use this method</th></tr>
+ * <tr>
+ * <td>The document type for the root element.</td>
+ * <td>{@link XmlOptions#setDocumentType}</td>
+ * </tr>
+ * <tr>
+ * <td>Whether value facets should be checked as they are set.</td>
+ * <td>{@link XmlOptions#setValidateOnSet}</td>
+ * </tr>
+ * </table>
+ *
+ * @param options Options specifying root document type and/or value facet
+ * checking.
+ * @return A new, empty instance of XmlObject.</li>
+ */
+ @Override
+ public T newInstance(XmlOptions options) {
+ return (T)XmlBeans.getContextTypeLoader().newInstance(getInnerType(), options);
+ }
+
+ /**
+ * Creates an immutable {@link XmlObject} value
+ */
+ public T newValue(Object obj) {
+ return (T)getType().newValue(obj);
+ }
+
+ /**
+ * Parses the given {@link String} as XML.
+ */
+ @Override
+ public T parse(String xmlAsString) throws XmlException {
+ return (T)XmlBeans.getContextTypeLoader().parse(xmlAsString, getInnerType(), null);
+ }
+
+ /**
+ * Parses the given {@link String} as XML.
+ * <p>
+ * Use the <em>options</em> parameter to specify the following:</p>
+ *
+ * <table>
+ * <tr><th>To specify this</th><th>Use this method</th></tr>
+ * <tr>
+ * <td>The document type for the root element.</td>
+ * <td>{@link XmlOptions#setDocumentType}</td>
+ * </tr>
+ * <tr>
+ * <td>To place line number annotations in the store when parsing a document.</td>
+ * <td>{@link XmlOptions#setLoadLineNumbers}</td>
+ * </tr>
+ * <tr>
+ * <td>To replace the document element with the specified QName when parsing.</td>
+ * <td>{@link XmlOptions#setLoadReplaceDocumentElement}</td>
+ * </tr>
+ * <tr>
+ * <td>To strip all insignificant whitespace when parsing a document.</td>
+ * <td>{@link XmlOptions#setLoadStripWhitespace}</td>
+ * </tr>
+ * <tr>
+ * <td>To strip all comments when parsing a document.</td>
+ * <td>{@link XmlOptions#setLoadStripComments}</td>
+ * </tr>
+ * <tr>
+ * <td>To strip all processing instructions when parsing a document.</td>
+ * <td>{@link XmlOptions#setLoadStripProcinsts}</td>
+ * </tr>
+ * <tr>
+ * <td>A map of namespace URI substitutions to use when parsing a document.</td>
+ * <td>{@link XmlOptions#setLoadSubstituteNamespaces}</td>
+ * </tr>
+ * <tr>
+ * <td>Additional namespace mappings to be added when parsing a document.</td>
+ * <td>{@link XmlOptions#setLoadAdditionalNamespaces}</td>
+ * </tr>
+ * <tr>
+ * <td>To trim the underlying XML text buffer immediately after parsing
+ * a document, resulting in a smaller memory footprint.</td>
+ * <td>{@link XmlOptions#setLoadTrimTextBuffer}</td>
+ * </tr>
+ * </table>
+ *
+ * @param xmlAsString The string to parse.
+ * @param options Options as specified.
+ * @return A new instance containing the specified XML.
+ */
+ @Override
+ public T parse(String xmlAsString, XmlOptions options) throws XmlException {
+ return (T)XmlBeans.getContextTypeLoader().parse(xmlAsString, getInnerType(), options);
+ }
+
+ /**
+ * Parses the given {@link File} as XML.
+ */
+ @Override
+ public T parse(File file) throws XmlException, IOException {
+ return (T)XmlBeans.getContextTypeLoader().parse(file, getInnerType(), null);
+ }
+
+ /**
+ * Parses the given {@link File} as XML.
+ */
+ @Override
+ public T parse(File file, XmlOptions options) throws XmlException, IOException {
+ return (T)XmlBeans.getContextTypeLoader().parse(file, getInnerType(), options);
+ }
+
+ /**
+ * Downloads the given {@link java.net.URL} as XML.
+ */
+ @Override
+ public T parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (T)XmlBeans.getContextTypeLoader().parse(u, getInnerType(), null);
+ }
+
+ /**
+ * Downloads the given {@link java.net.URL} as XML.
+ */
+ @Override
+ public T parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (T)XmlBeans.getContextTypeLoader().parse(u, getInnerType(), options);
+ }
+
+ /**
+ * Decodes and parses the given {@link InputStream} as XML.
+ */
+ @Override
+ public T parse(InputStream is) throws XmlException, IOException {
+ return (T)XmlBeans.getContextTypeLoader().parse(is, getInnerType(), null);
+ }
+
+ /**
+ * Decodes and parses the given {@link XMLStreamReader} as XML.
+ */
+ @Override
+ public T parse(XMLStreamReader xsr) throws XmlException {
+ return (T)XmlBeans.getContextTypeLoader().parse(xsr, getInnerType(), null);
+ }
+
+ /**
+ * Decodes and parses the given {@link InputStream} as XML.
+ * <p>
+ * Use the <em>options</em> parameter to specify the following:</p>
+ *
+ * <table>
+ * <tr><th>To specify this</th><th>Use this method</th></tr>
+ * <tr>
+ * <td>The character encoding to use when parsing or writing a document.</td>
+ * <td>{@link XmlOptions#setCharacterEncoding}</td>
+ * </tr>
+ * <tr>
+ * <td>The document type for the root element.</td>
+ * <td>{@link XmlOptions#setDocumentType}</td>
+ * </tr>
+ * <tr>
+ * <td>Place line number annotations in the store when parsing a document.</td>
+ * <td>{@link XmlOptions#setLoadLineNumbers}</td>
+ * </tr>
+ * <tr>
+ * <td>Replace the document element with the specified QName when parsing.</td>
+ * <td>{@link XmlOptions#setLoadReplaceDocumentElement}</td>
+ * </tr>
+ * <tr>
+ * <td>Strip all insignificant whitespace when parsing a document.</td>
+ * <td>{@link XmlOptions#setLoadStripWhitespace}</td>
+ * </tr>
+ * <tr>
+ * <td>Strip all comments when parsing a document.</td>
+ * <td>{@link XmlOptions#setLoadStripComments}</td>
+ * </tr>
+ * <tr>
+ * <td>Strip all processing instructions when parsing a document.</td>
+ * <td>{@link XmlOptions#setLoadStripProcinsts}</td>
+ * </tr>
+ * <tr>
+ * <td>Set a map of namespace URI substitutions to use when parsing a document.</td>
+ * <td>{@link XmlOptions#setLoadSubstituteNamespaces}</td>
+ * </tr>
+ * <tr>
+ * <td>Set additional namespace mappings to be added when parsing a document.</td>
+ * <td>{@link XmlOptions#setLoadAdditionalNamespaces}</td>
+ * </tr>
+ * <tr>
+ * <td>Trim the underlying XML text buffer immediately after parsing
+ * a document, resulting in a smaller memory footprint.</td>
+ * <td>{@link XmlOptions#setLoadTrimTextBuffer}</td>
+ * </tr>
+ * </table>
+ */
+ @Override
+ public T parse(InputStream is, XmlOptions options) throws XmlException, IOException {
+ return (T)XmlBeans.getContextTypeLoader().parse(is, getInnerType(), options);
+ }
+
+ /**
+ * Parses the given {@link XMLStreamReader} as XML.
+ */
+ @Override
+ public T parse(XMLStreamReader xsr, XmlOptions options) throws XmlException {
+ return (T)XmlBeans.getContextTypeLoader().parse(xsr, getInnerType(), options);
+ }
+
+ /**
+ * Parses the given {@link Reader} as XML.
+ */
+ @Override
+ public T parse(Reader r) throws XmlException, IOException {
+ return (T)XmlBeans.getContextTypeLoader().parse(r, getInnerType(), null);
+ }
+
+ /**
+ * Parses the given {@link Reader} as XML.
+ */
+ @Override
+ public T parse(Reader r, XmlOptions options) throws XmlException, IOException {
+ return (T)XmlBeans.getContextTypeLoader().parse(r, getInnerType(), options);
+ }
+
+ /**
+ * Converts the given DOM {@link Node} into an XmlObject.
+ */
+ @Override
+ public T parse(Node node) throws XmlException {
+ return (T)XmlBeans.getContextTypeLoader().parse(node, getInnerType(), null);
+ }
+
+ /**
+ * Converts the given DOM {@link Node} into an XmlObject.
+ */
+ @Override
+ public T parse(Node node, XmlOptions options) throws XmlException {
+ return (T)XmlBeans.getContextTypeLoader().parse(node, getInnerType(), options);
+ }
+
+ /**
+ * Returns an {@link XmlSaxHandler} that can load an XmlObject from SAX events.
+ */
+ public XmlSaxHandler newXmlSaxHandler() {
+ return XmlBeans.getContextTypeLoader().newXmlSaxHandler(getInnerType(), null);
+ }
+
+ /**
+ * Returns an {@link XmlSaxHandler} that can load an XmlObject from SAX events.
+ */
+ public XmlSaxHandler newXmlSaxHandler(XmlOptions options) {
+ return XmlBeans.getContextTypeLoader().newXmlSaxHandler(getInnerType(), options);
+ }
+
+ /**
+ * Creates a new DOMImplementation object
+ */
+ public DOMImplementation newDomImplementation() {
+ return XmlBeans.getContextTypeLoader().newDomImplementation(null);
+ }
+
+ /**
+ * Creates a new DOMImplementation object, taking options
+ */
+ public DOMImplementation newDomImplementation(XmlOptions options) {
+ return XmlBeans.getContextTypeLoader().newDomImplementation(options);
+ }
+
+ private SchemaType getInnerType() {
+ return isAnyType ? null : getType();
+ }
+}
diff --git a/src/main/java/org/apache/xmlbeans/impl/tool/Parameters.java b/src/main/java/org/apache/xmlbeans/impl/tool/Parameters.java
new file mode 100644
index 0000000..ec2a6ea
--- /dev/null
+++ b/src/main/java/org/apache/xmlbeans/impl/tool/Parameters.java
@@ -0,0 +1,328 @@
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xmlbeans.impl.tool;
+
+import org.apache.xmlbeans.SchemaCodePrinter;
+import org.apache.xmlbeans.XmlError;
+import org.apache.xmlbeans.XmlOptions;
+import org.xml.sax.EntityResolver;
+
+import java.io.File;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+public class Parameters {
+ private File baseDir;
+ private File[] xsdFiles;
+ private File[] wsdlFiles;
+ private File[] javaFiles;
+ private File[] configFiles;
+ private URL[] urlFiles;
+ private File[] classpath;
+ private File outputJar;
+ private String name;
+ private File srcDir;
+ private File classesDir;
+ private String memoryInitialSize;
+ private String memoryMaximumSize;
+ private String compiler;
+ private boolean nojavac;
+ private boolean quiet;
+ private boolean verbose;
+ private boolean download;
+ private Collection<XmlError> errorListener;
+ private boolean noUpa;
+ private boolean noPvr;
+ private boolean noAnn;
+ private boolean noVDoc;
+ private boolean noExt;
+ private boolean debug;
+ private boolean incrementalSrcGen;
+ private String repackage;
+ private List<Extension> extensions = Collections.emptyList();
+ private Set<String> mdefNamespaces = Collections.emptySet();
+ private String catalogFile;
+ private SchemaCodePrinter schemaCodePrinter;
+ private EntityResolver entityResolver;
+ private Set<XmlOptions.BeanMethod> partialMethods = Collections.emptySet();
+
+ public File getBaseDir() {
+ return baseDir;
+ }
+
+ public void setBaseDir(File baseDir) {
+ this.baseDir = baseDir;
+ }
+
+ public File[] getXsdFiles() {
+ return xsdFiles;
+ }
+
+ public void setXsdFiles(File... xsdFiles) {
+ this.xsdFiles = xsdFiles;
+ }
+
+ public File[] getWsdlFiles() {
+ return wsdlFiles;
+ }
+
+ public void setWsdlFiles(File[] wsdlFiles) {
+ this.wsdlFiles = wsdlFiles;
+ }
+
+ public File[] getJavaFiles() {
+ return javaFiles;
+ }
+
+ public void setJavaFiles(File[] javaFiles) {
+ this.javaFiles = javaFiles;
+ }
+
+ public File[] getConfigFiles() {
+ return configFiles;
+ }
+
+ public void setConfigFiles(File[] configFiles) {
+ this.configFiles = configFiles;
+ }
+
+ public URL[] getUrlFiles() {
+ return urlFiles;
+ }
+
+ public void setUrlFiles(URL[] urlFiles) {
+ this.urlFiles = urlFiles;
+ }
+
+ public File[] getClasspath() {
+ return classpath;
+ }
+
+ public void setClasspath(File[] classpath) {
+ this.classpath = classpath;
+ }
+
+ public File getOutputJar() {
+ return outputJar;
+ }
+
+ public void setOutputJar(File outputJar) {
+ this.outputJar = outputJar;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public File getSrcDir() {
+ return srcDir;
+ }
+
+ public void setSrcDir(File srcDir) {
+ this.srcDir = srcDir;
+ }
+
+ public File getClassesDir() {
+ return classesDir;
+ }
+
+ public void setClassesDir(File classesDir) {
+ this.classesDir = classesDir;
+ }
+
+ public boolean isNojavac() {
+ return nojavac;
+ }
+
+ public void setNojavac(boolean nojavac) {
+ this.nojavac = nojavac;
+ }
+
+ public boolean isQuiet() {
+ return quiet;
+ }
+
+ public void setQuiet(boolean quiet) {
+ this.quiet = quiet;
+ }
+
+ public boolean isVerbose() {
+ return verbose;
+ }
+
+ public void setVerbose(boolean verbose) {
+ this.verbose = verbose;
+ }
+
+ public boolean isDownload() {
+ return download;
+ }
+
+ public void setDownload(boolean download) {
+ this.download = download;
+ }
+
+ public boolean isNoUpa() {
+ return noUpa;
+ }
+
+ public void setNoUpa(boolean noUpa) {
+ this.noUpa = noUpa;
+ }
+
+ public boolean isNoPvr() {
+ return noPvr;
+ }
+
+ public void setNoPvr(boolean noPvr) {
+ this.noPvr = noPvr;
+ }
+
+ public boolean isNoAnn() {
+ return noAnn;
+ }
+
+ public void setNoAnn(boolean noAnn) {
+ this.noAnn = noAnn;
+ }
+
+ public boolean isNoVDoc() {
+ return noVDoc;
+ }
+
+ public void setNoVDoc(boolean newNoVDoc) {
+ this.noVDoc = newNoVDoc;
+ }
+
+ public boolean isNoExt() {
+ return noExt;
+ }
+
+ public void setNoExt(boolean newNoExt) {
+ this.noExt = newNoExt;
+ }
+
+ public boolean isIncrementalSrcGen() {
+ return incrementalSrcGen;
+ }
+
+ public void setIncrementalSrcGen(boolean incrSrcGen) {
+ this.incrementalSrcGen = incrSrcGen;
+ }
+
+ public boolean isDebug() {
+ return debug;
+ }
+
+ public void setDebug(boolean debug) {
+ this.debug = debug;
+ }
+
+ public String getMemoryInitialSize() {
+ return memoryInitialSize;
+ }
+
+ public void setMemoryInitialSize(String memoryInitialSize) {
+ this.memoryInitialSize = memoryInitialSize;
+ }
+
+ public String getMemoryMaximumSize() {
+ return memoryMaximumSize;
+ }
+
+ public void setMemoryMaximumSize(String memoryMaximumSize) {
+ this.memoryMaximumSize = memoryMaximumSize;
+ }
+
+ public String getCompiler() {
+ return compiler;
+ }
+
+ public void setCompiler(String compiler) {
+ this.compiler = compiler;
+ }
+
+ public Collection<XmlError> getErrorListener() {
+ return errorListener;
+ }
+
+ public void setErrorListener(Collection<XmlError> errorListener) {
+ this.errorListener = errorListener;
+ }
+
+ public String getRepackage() {
+ return repackage;
+ }
+
+ public void setRepackage(String newRepackage) {
+ repackage = newRepackage;
+ }
+
+ public List<Extension> getExtensions() {
+ return extensions;
+ }
+
+ public void setExtensions(List<Extension> extensions) {
+ this.extensions = extensions;
+ }
+
+ public Set<String> getMdefNamespaces() {
+ return mdefNamespaces;
+ }
+
+ public void setMdefNamespaces(Set<String> mdefNamespaces) {
+ this.mdefNamespaces = mdefNamespaces;
+ }
+
+ public String getCatalogFile() {
+ return catalogFile;
+ }
+
+ public void setCatalogFile(String catalogPropFile) {
+ this.catalogFile = catalogPropFile;
+ }
+
+ public SchemaCodePrinter getSchemaCodePrinter() {
+ return schemaCodePrinter;
+ }
+
+ public void setSchemaCodePrinter(SchemaCodePrinter schemaCodePrinter) {
+ this.schemaCodePrinter = schemaCodePrinter;
+ }
+
+ public EntityResolver getEntityResolver() {
+ return entityResolver;
+ }
+
+ public void setEntityResolver(EntityResolver entityResolver) {
+ this.entityResolver = entityResolver;
+ }
+
+ public Set<XmlOptions.BeanMethod> getPartialMethods() {
+ return partialMethods;
+ }
+
+ public void setPartialMethods(Set<XmlOptions.BeanMethod> partialMethods) {
+ this.partialMethods = partialMethods;
+ }
+}
diff --git a/src/main/java/org/apache/xmlbeans/impl/tool/SchemaCompiler.java b/src/main/java/org/apache/xmlbeans/impl/tool/SchemaCompiler.java
index 0ab9824..164c1c1 100644
--- a/src/main/java/org/apache/xmlbeans/impl/tool/SchemaCompiler.java
+++ b/src/main/java/org/apache/xmlbeans/impl/tool/SchemaCompiler.java
@@ -16,6 +16,7 @@
package org.apache.xmlbeans.impl.tool;
import org.apache.xmlbeans.*;
+import org.apache.xmlbeans.XmlOptions.BeanMethod;
import org.apache.xmlbeans.impl.common.*;
import org.apache.xmlbeans.impl.config.BindingConfigImpl;
import org.apache.xmlbeans.impl.repackage.Repackager;
@@ -62,6 +63,8 @@
System.out.println(" -license - prints license information");
System.out.println(" -allowmdef \"[ns] [ns] [ns]\" - ignores multiple defs in given namespaces (use ##local for no-namespace)");
System.out.println(" -catalog [file] - catalog file for org.apache.xml.resolver.tools.CatalogResolver. (Note: needs resolver.jar from http://xml.apache.org/commons/components/resolver/index.html)");
+ System.out.println(" -partialMethods [list] - comma separated list of bean methods to be generated. Use \"-\" to negate and \"ALL\" for all." );
+ System.out.println(" processed left-to-right, e.g. \"ALL,-GET_LIST\" exclude java.util.List getters - see XmlOptions.BeanMethod" );
/* Undocumented feature - pass in one schema compiler extension and related parameters
System.out.println(" -repackage - repackage specification");
System.out.println(" -extension - registers a schema compiler extension");
@@ -111,6 +114,8 @@
opts.add("extensionParms");
opts.add("allowmdef");
opts.add("catalog");
+ opts.add("partialMethods");
+
CommandLine cl = new CommandLine(args, flags, opts);
if (cl.getOpt("h") != null || cl.getOpt("help") != null || cl.getOpt("usage") != null) {
@@ -298,6 +303,8 @@
String catString = cl.getOpt("catalog");
+ String partialMethods = cl.getOpt("partialMethods");
+
Parameters params = new Parameters();
params.setBaseDir(baseDir);
params.setXsdFiles(xsdFiles);
@@ -329,7 +336,7 @@
params.setMdefNamespaces(mdefNamespaces);
params.setCatalogFile(catString);
params.setSchemaCodePrinter(codePrinter);
-
+ params.setPartialMethods(parsePartialMethods(partialMethods));
boolean result = compile(params);
if (tempdir != null) {
@@ -343,297 +350,6 @@
System.exit(0);
}
- public static class Parameters {
- private File baseDir;
- private File[] xsdFiles;
- private File[] wsdlFiles;
- private File[] javaFiles;
- private File[] configFiles;
- private URL[] urlFiles;
- private File[] classpath;
- private File outputJar;
- private String name;
- private File srcDir;
- private File classesDir;
- private String memoryInitialSize;
- private String memoryMaximumSize;
- private String compiler;
- private boolean nojavac;
- private boolean quiet;
- private boolean verbose;
- private boolean download;
- private Collection<XmlError> errorListener;
- private boolean noUpa;
- private boolean noPvr;
- private boolean noAnn;
- private boolean noVDoc;
- private boolean noExt;
- private boolean debug;
- private boolean incrementalSrcGen;
- private String repackage;
- private List<Extension> extensions = Collections.emptyList();
- private Set<String> mdefNamespaces = Collections.emptySet();
- private String catalogFile;
- private SchemaCodePrinter schemaCodePrinter;
- private EntityResolver entityResolver;
-
- public File getBaseDir() {
- return baseDir;
- }
-
- public void setBaseDir(File baseDir) {
- this.baseDir = baseDir;
- }
-
- public File[] getXsdFiles() {
- return xsdFiles;
- }
-
- public void setXsdFiles(File[] xsdFiles) {
- this.xsdFiles = xsdFiles;
- }
-
- public File[] getWsdlFiles() {
- return wsdlFiles;
- }
-
- public void setWsdlFiles(File[] wsdlFiles) {
- this.wsdlFiles = wsdlFiles;
- }
-
- public File[] getJavaFiles() {
- return javaFiles;
- }
-
- public void setJavaFiles(File[] javaFiles) {
- this.javaFiles = javaFiles;
- }
-
- public File[] getConfigFiles() {
- return configFiles;
- }
-
- public void setConfigFiles(File[] configFiles) {
- this.configFiles = configFiles;
- }
-
- public URL[] getUrlFiles() {
- return urlFiles;
- }
-
- public void setUrlFiles(URL[] urlFiles) {
- this.urlFiles = urlFiles;
- }
-
- public File[] getClasspath() {
- return classpath;
- }
-
- public void setClasspath(File[] classpath) {
- this.classpath = classpath;
- }
-
- public File getOutputJar() {
- return outputJar;
- }
-
- public void setOutputJar(File outputJar) {
- this.outputJar = outputJar;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public File getSrcDir() {
- return srcDir;
- }
-
- public void setSrcDir(File srcDir) {
- this.srcDir = srcDir;
- }
-
- public File getClassesDir() {
- return classesDir;
- }
-
- public void setClassesDir(File classesDir) {
- this.classesDir = classesDir;
- }
-
- public boolean isNojavac() {
- return nojavac;
- }
-
- public void setNojavac(boolean nojavac) {
- this.nojavac = nojavac;
- }
-
- public boolean isQuiet() {
- return quiet;
- }
-
- public void setQuiet(boolean quiet) {
- this.quiet = quiet;
- }
-
- public boolean isVerbose() {
- return verbose;
- }
-
- public void setVerbose(boolean verbose) {
- this.verbose = verbose;
- }
-
- public boolean isDownload() {
- return download;
- }
-
- public void setDownload(boolean download) {
- this.download = download;
- }
-
- public boolean isNoUpa() {
- return noUpa;
- }
-
- public void setNoUpa(boolean noUpa) {
- this.noUpa = noUpa;
- }
-
- public boolean isNoPvr() {
- return noPvr;
- }
-
- public void setNoPvr(boolean noPvr) {
- this.noPvr = noPvr;
- }
-
- public boolean isNoAnn() {
- return noAnn;
- }
-
- public void setNoAnn(boolean noAnn) {
- this.noAnn = noAnn;
- }
-
- public boolean isNoVDoc() {
- return noVDoc;
- }
-
- public void setNoVDoc(boolean newNoVDoc) {
- this.noVDoc = newNoVDoc;
- }
-
- public boolean isNoExt() {
- return noExt;
- }
-
- public void setNoExt(boolean newNoExt) {
- this.noExt = newNoExt;
- }
-
- public boolean isIncrementalSrcGen() {
- return incrementalSrcGen;
- }
-
- public void setIncrementalSrcGen(boolean incrSrcGen) {
- this.incrementalSrcGen = incrSrcGen;
- }
-
- public boolean isDebug() {
- return debug;
- }
-
- public void setDebug(boolean debug) {
- this.debug = debug;
- }
-
- public String getMemoryInitialSize() {
- return memoryInitialSize;
- }
-
- public void setMemoryInitialSize(String memoryInitialSize) {
- this.memoryInitialSize = memoryInitialSize;
- }
-
- public String getMemoryMaximumSize() {
- return memoryMaximumSize;
- }
-
- public void setMemoryMaximumSize(String memoryMaximumSize) {
- this.memoryMaximumSize = memoryMaximumSize;
- }
-
- public String getCompiler() {
- return compiler;
- }
-
- public void setCompiler(String compiler) {
- this.compiler = compiler;
- }
-
- public Collection<XmlError> getErrorListener() {
- return errorListener;
- }
-
- public void setErrorListener(Collection<XmlError> errorListener) {
- this.errorListener = errorListener;
- }
-
- public String getRepackage() {
- return repackage;
- }
-
- public void setRepackage(String newRepackage) {
- repackage = newRepackage;
- }
-
- public List<Extension> getExtensions() {
- return extensions;
- }
-
- public void setExtensions(List<Extension> extensions) {
- this.extensions = extensions;
- }
-
- public Set<String> getMdefNamespaces() {
- return mdefNamespaces;
- }
-
- public void setMdefNamespaces(Set<String> mdefNamespaces) {
- this.mdefNamespaces = mdefNamespaces;
- }
-
- public String getCatalogFile() {
- return catalogFile;
- }
-
- public void setCatalogFile(String catalogPropFile) {
- this.catalogFile = catalogPropFile;
- }
-
- public SchemaCodePrinter getSchemaCodePrinter() {
- return schemaCodePrinter;
- }
-
- public void setSchemaCodePrinter(SchemaCodePrinter schemaCodePrinter) {
- this.schemaCodePrinter = schemaCodePrinter;
- }
-
- public EntityResolver getEntityResolver() {
- return entityResolver;
- }
-
- public void setEntityResolver(EntityResolver entityResolver) {
- this.entityResolver = entityResolver;
- }
- }
-
private static SchemaTypeSystem loadTypeSystem(String name, File[] xsdFiles, File[] wsdlFiles, URL[] urlFiles, File[] configFiles,
File[] javaFiles, ResourceLoader cpResourceLoader,
boolean download, boolean noUpa, boolean noPvr, boolean noAnn, boolean noVDoc, boolean noExt,
@@ -894,6 +610,7 @@
boolean noExt = params.isNoExt();
boolean incrSrcGen = params.isIncrementalSrcGen();
Collection<XmlError> outerErrorListener = params.getErrorListener();
+ Set<BeanMethod> partialMethods = params.getPartialMethods();
String repackage = params.getRepackage();
@@ -968,6 +685,7 @@
if (codePrinter != null) {
options.setSchemaCodePrinter(codePrinter);
}
+ options.setCompilePartialMethod(partialMethods);
// save .xsb files
system.save(filer);
@@ -1035,6 +753,26 @@
return result;
}
+ static Set<BeanMethod> parsePartialMethods(String partialMethods) {
+ final Set<BeanMethod> beanMethods = new HashSet<>();
+ if (partialMethods != null) {
+ for (String pm : partialMethods.split(",")) {
+ if ("ALL".equals(pm)) {
+ beanMethods.addAll(Arrays.asList(BeanMethod.values()));
+ continue;
+ }
+ boolean neg = pm.startsWith("-");
+ BeanMethod bm = BeanMethod.valueOf(pm.substring(neg ? 1 : 0));
+ if (neg) {
+ beanMethods.remove(bm);
+ } else {
+ beanMethods.add(bm);
+ }
+ }
+ }
+ return beanMethods.isEmpty() ? null : beanMethods;
+ }
+
private static void runExtensions(List<Extension> extensions, SchemaTypeSystem system, File classesDir) {
if (extensions != null && extensions.size() > 0) {
SchemaCompilerExtension sce;
diff --git a/src/main/java/org/apache/xmlbeans/impl/tool/XMLBean.java b/src/main/java/org/apache/xmlbeans/impl/tool/XMLBean.java
index 337a47a..ecb4d82 100644
--- a/src/main/java/org/apache/xmlbeans/impl/tool/XMLBean.java
+++ b/src/main/java/org/apache/xmlbeans/impl/tool/XMLBean.java
@@ -25,6 +25,7 @@
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference;
import org.apache.xmlbeans.XmlError;
+import org.apache.xmlbeans.XmlOptions;
import org.apache.xmlbeans.impl.common.IOUtil;
import java.io.File;
@@ -82,7 +83,8 @@
memoryInitialSize,
memoryMaximumSize,
catalog,
- repackage;
+ repackage,
+ partialMethods;
private final List<Extension> extensions = new ArrayList<>();
@@ -203,7 +205,7 @@
}
// generate the source
- SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
+ Parameters params = new Parameters();
params.setBaseDir(theBasedir);
params.setXsdFiles(xsdArray);
params.setWsdlFiles(wsdlArray);
@@ -229,6 +231,7 @@
params.setNoVDoc(novdoc);
params.setNoExt(noext);
params.setRepackage(repackage);
+ params.setPartialMethods(SchemaCompiler.parsePartialMethods(partialMethods));
success = SchemaCompiler.compile(params);
if (success && !srconly) {
@@ -764,6 +767,20 @@
this.repackage = repackage;
}
+ public String getPartialMethods() {
+ return partialMethods;
+ }
+
+ /**
+ * Comma separated list of bean methods to be generated. Use "-" to negate and "ALL" for all.
+ * processed left-to-right, e.g. "ALL,-GET_LIST" exclude java.util.List getters
+ *
+ * @see XmlOptions.BeanMethod
+ */
+ public void setPartialMethods(String partialMethods) {
+ this.partialMethods = partialMethods;
+ }
+
private static URI uriFromFile(File f) {
if (f == null) {
return null;
diff --git a/src/main/java/org/apache/xmlbeans/impl/values/JavaListObject.java b/src/main/java/org/apache/xmlbeans/impl/values/JavaListObject.java
new file mode 100644
index 0000000..15d8809
--- /dev/null
+++ b/src/main/java/org/apache/xmlbeans/impl/values/JavaListObject.java
@@ -0,0 +1,89 @@
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xmlbeans.impl.values;
+
+import java.util.AbstractList;
+import java.util.function.BiConsumer;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.Supplier;
+
+public class JavaListObject<T> extends AbstractList<T> {
+ private final Function<Integer,T> getter;
+ private final BiConsumer<Integer,T> setter;
+ private final BiConsumer<Integer,T> adder;
+ private final Consumer<Integer> remover;
+ private final Supplier<Integer> sizer;
+
+ public JavaListObject(
+ Function<Integer,T> getter,
+ BiConsumer<Integer,T> setter,
+ BiConsumer<Integer,T> adder,
+ Consumer<Integer> remover,
+ Supplier<Integer> sizer
+ ) {
+ this.getter = getter;
+ this.setter = setter;
+ this.adder = adder;
+ this.remover = remover;
+ this.sizer = sizer;
+ }
+
+
+ @Override
+ public T get(int index) {
+ if (getter == null) {
+ throw new IllegalStateException("XmlBean generated using partial methods - no getter method available");
+ }
+ return getter.apply(index);
+ }
+
+ @Override
+ public T set(int index, T element) {
+ if (setter == null) {
+ throw new IllegalStateException("XmlBean generated using partial methods - no setter method available");
+ }
+ T old = get(index);
+ setter.accept(index, element);
+ return old;
+ }
+
+ @Override
+ public void add(int index, T t) {
+ if (adder == null) {
+ throw new IllegalStateException("XmlBean generated using partial methods - no add method available");
+ }
+ adder.accept(index, t);
+ }
+
+ @Override
+ public T remove(int index) {
+ if (remover == null) {
+ throw new IllegalStateException("XmlBean generated using partial methods - no remove method available");
+ }
+ T old = get(index);
+ remover.accept(index);
+ return old;
+ }
+
+ @Override
+ public int size() {
+ if (sizer == null) {
+ throw new IllegalStateException("XmlBean generated using partial methods - no size-of method available");
+ }
+ return sizer.get();
+ }
+}
diff --git a/src/main/java/org/apache/xmlbeans/impl/values/JavaListXmlObject.java b/src/main/java/org/apache/xmlbeans/impl/values/JavaListXmlObject.java
new file mode 100644
index 0000000..5d0b9c1
--- /dev/null
+++ b/src/main/java/org/apache/xmlbeans/impl/values/JavaListXmlObject.java
@@ -0,0 +1,91 @@
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlObject;
+
+import java.util.AbstractList;
+import java.util.function.BiConsumer;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.Supplier;
+
+public class JavaListXmlObject<T extends XmlObject> extends AbstractList<T> {
+ private final Function<Integer,T> getter;
+ private final BiConsumer<Integer,T> setter;
+ private final Function<Integer,T> adder;
+ private final Consumer<Integer> remover;
+ private final Supplier<Integer> sizer;
+
+ public JavaListXmlObject(
+ Function<Integer,T> getter,
+ BiConsumer<Integer,T> setter,
+ Function<Integer,T> adder,
+ Consumer<Integer> remover,
+ Supplier<Integer> sizer
+ ) {
+ this.getter = getter;
+ this.setter = setter;
+ this.adder = adder;
+ this.remover = remover;
+ this.sizer = sizer;
+ }
+
+
+ @Override
+ public T get(int index) {
+ if (getter == null) {
+ throw new IllegalStateException("XmlBean generated using partial methods - no getter available");
+ }
+ return getter.apply(index);
+ }
+
+ @Override
+ public T set(int index, T element) {
+ if (setter == null) {
+ throw new IllegalStateException("XmlBean generated using partial methods - no setter available");
+ }
+ T old = get(index);
+ setter.accept(index, element);
+ return old;
+ }
+
+ @Override
+ public void add(int index, T t) {
+ if (adder == null) {
+ throw new IllegalStateException("XmlBean generated using partial methods - no add method available");
+ }
+ adder.apply(index).set(t);
+ }
+
+ @Override
+ public T remove(int index) {
+ if (remover == null) {
+ throw new IllegalStateException("XmlBean generated using partial methods - no remove method available");
+ }
+ T old = get(index);
+ remover.accept(index);
+ return old;
+ }
+
+ @Override
+ public int size() {
+ if (sizer == null) {
+ throw new IllegalStateException("XmlBean generated using partial methods - no size-of method available");
+ }
+ return sizer.get();
+ }
+}
diff --git a/src/main/multimodule/java9/module-info.class b/src/main/multimodule/java9/module-info.class
index af3876f..836fbf5 100644
--- a/src/main/multimodule/java9/module-info.class
+++ b/src/main/multimodule/java9/module-info.class
Binary files differ
diff --git a/src/test/java/compile/scomp/checkin/CompilationTests.java b/src/test/java/compile/scomp/checkin/CompilationTests.java
index 4d294af..c4e5bdc 100644
--- a/src/test/java/compile/scomp/checkin/CompilationTests.java
+++ b/src/test/java/compile/scomp/checkin/CompilationTests.java
@@ -15,14 +15,12 @@
package compile.scomp.checkin;
-import common.Common;
import compile.scomp.common.CompileCommon;
import org.apache.xmlbeans.*;
+import org.apache.xmlbeans.XmlOptions.BeanMethod;
import org.apache.xmlbeans.impl.common.QNameHelper;
-import org.apache.xmlbeans.impl.tool.CodeGenUtil;
-import org.apache.xmlbeans.impl.tool.Diff;
-import org.apache.xmlbeans.impl.tool.SchemaCodeGenerator;
-import org.apache.xmlbeans.impl.tool.SchemaCompiler;
+import org.apache.xmlbeans.impl.tool.*;
+import org.apache.xmlbeans.impl.util.FilerImpl;
import org.apache.xmlbeans.impl.xb.xsdschema.SchemaDocument;
import org.apache.xmlbeans.impl.xb.xsdschema.TopLevelComplexType;
import org.junit.Assert;
@@ -35,262 +33,30 @@
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
+import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.*;
+import java.util.stream.Stream;
import static common.Common.getRootFile;
+import static java.util.Collections.singletonList;
import static org.junit.Assert.*;
+@SuppressWarnings({"SpellCheckingInspection", "ResultOfMethodCallIgnored"})
public class CompilationTests {
- @Test
- public void testJ2EE() throws Throwable {
- deltree(xbeanOutput("compile/scomp/j2ee"));
- // First, compile schema
- File srcdir = xbeanOutput("compile/scomp/j2ee/j2eeconfigxml/src");
- File classesdir = xbeanOutput("compile/scomp/j2ee/j2eeconfigxml/classes");
- File outputjar = xbeanOutput("compile/scomp/j2ee/j2eeconfigxml.jar");
- SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
- params.setXsdFiles(new File[]{
- xbeanCase("j2ee/application-client_1_4.xsd"),
- xbeanCase("j2ee/application_1_4.xsd"),
- xbeanCase("j2ee/connector_1_5.xsd"),
- xbeanCase("j2ee/ejb-jar_2_1.xsd"),
- xbeanCase("j2ee/j2ee_1_4.xsd"),
- xbeanCase("j2ee/jsp_2_0.xsd"),
- xbeanCase("j2ee/web-app_2_4.xsd"),
- xbeanCase("j2ee/XML.xsd")
- });
- params.setSrcDir(srcdir);
- params.setClassesDir(classesdir);
- params.setOutputJar(outputjar);
- params.setMdefNamespaces(Collections.singleton("http://java.sun.com/xml/ns/j2ee"));
- List errors = new ArrayList();
- params.setErrorListener(errors);
- boolean result = SchemaCompiler.compile(params);
- StringWriter message = new StringWriter();
- if (!result)
- dumpErrors(errors, new PrintWriter(message));
- assertTrue("Build failed:" + message, result);
- assertTrue("Cannot find " + outputjar, outputjar.exists());
- }
+ private static final File fwroot = new File(getRootFile());
- @Test
- public void testIncrementalCompilation() throws Throwable {
- File[] files = new File[]{
- xbeanCase("incr/incr1.xsd"),
- xbeanCase("incr/incr3.xsd"),
- xbeanCase("incr/incr4.xsd"),
- xbeanCase("incr/incr2.xsd"),
- xbeanCase("incr/incr2-1.xsd")
- };
- int n = files.length;
- SchemaDocument.Schema[] schemas = new SchemaDocument.Schema[n - 1];
- SchemaTypeSystem system;
- deltree(xbeanOutput("compile/scomp/incr"));
- File out = xbeanOutput("compile/scomp/incr/out");
- File outincr = xbeanOutput("compile/scomp/incr/outincr");
-
- for (int i = 0; i < n - 2; i++)
- schemas[i] = SchemaDocument.Factory.parse(files[i]).getSchema();
- // Compile incrementally
- // Initial compile
- schemas[n - 2] = SchemaDocument.Factory.parse(files[n - 2]).getSchema();
- List errors = new ArrayList();
- XmlOptions options = (new XmlOptions()).setErrorListener(errors);
- SchemaTypeSystem builtin = XmlBeans.getBuiltinTypeSystem();
- system = XmlBeans.compileXsd(schemas, builtin, options);
- Assert.assertNotNull("Compilation failed during inititial compile.", system);
- System.out.println("-= Initial Compile =-");
-
- for (int i = 0; i < system.globalTypes().length; i++) {
- System.out.println("[" + i + "]-" + system.globalTypes()[i].getName());
- }
- for (int i = 0; i < system.globalAttributes().length; i++) {
- System.out.println("[" + i + "]-" + system.globalAttributes()[i].getName());
- }
- for (int i = 0; i < system.globalElements().length; i++) {
- System.out.println("[" + i + "]=" + system.globalElements()[i].getName());
- }
-
- // Incremental compile
- String url = schemas[n - 2].documentProperties().getSourceName();
- SchemaDocument.Schema[] schemas1 = new SchemaDocument.Schema[1];
- schemas1[0] = SchemaDocument.Factory.parse(files[n - 1]).getSchema();
- schemas1[0].documentProperties().setSourceName(url);
- errors.clear();
- system = XmlBeans.compileXsd(system, schemas1, builtin, options);
- Assert.assertNotNull("Compilation failed during incremental compile.", system);
- SchemaCodeGenerator.saveTypeSystem(system, outincr, null, null, null);
- System.out.println("-= Incremental Compile =-");
- for (int i = 0; i < system.globalTypes().length; i++) {
- System.out.println("[" + i + "]-" + system.globalTypes()[i].getName());
- }
- for (int i = 0; i < system.globalAttributes().length; i++) {
- System.out.println("[" + i + "]-" + system.globalAttributes()[i].getName());
- }
- for (int i = 0; i < system.globalElements().length; i++) {
- System.out.println("[" + i + "]=" + system.globalElements()[i].getName());
- }
- // Now compile non-incrementally for the purpose of comparing the result
- errors.clear();
- schemas[n - 2] = schemas1[0];
- system = XmlBeans.compileXsd(schemas, builtin, options);
- Assert.assertNotNull("Compilation failed during reference compile.", system);
- SchemaCodeGenerator.saveTypeSystem(system, out, null, null, null);
-
- System.out.println("-= Sanity Compile =-");
- for (int i = 0; i < system.globalTypes().length; i++) {
- System.out.println("[" + i + "]-" + system.globalTypes()[i].getName());
- }
- for (int i = 0; i < system.globalAttributes().length; i++) {
- System.out.println("[" + i + "]-" + system.globalAttributes()[i].getName());
- }
- for (int i = 0; i < system.globalElements().length; i++) {
- System.out.println("[" + i + "]=" + system.globalElements()[i].getName());
- }
-
- // Compare the results
- String oldPropValue = System.getProperty("xmlbeans.diff.diffIndex");
- System.setProperty("xmlbeans.diff.diffIndex", "false");
- errors.clear();
- Diff.dirsAsTypeSystems(out, outincr, errors);
- System.setProperty("xmlbeans.diff.diffIndex", oldPropValue == null ? "true" : oldPropValue);
- if (errors.size() > 0) {
- StringWriter message = new StringWriter();
- for (int i = 0; i < errors.size(); i++)
- message.write(((String) errors.get(i)) + "\n");
- fail("Differences encountered:" + message);
- }
-
- }
-
- @Test
- public void testSchemaBookmarks() throws Throwable {
- File srcSchema = xbeanCase("../../simple/person/person.xsd");
- // Parse
- SchemaDocument.Schema parsed = SchemaDocument.Factory.parse(srcSchema).getSchema();
- // Navigate to the type definition
- TopLevelComplexType[] cTypes = parsed.getComplexTypeArray();
- boolean found = false;
- int i;
- for (i = 0; i < cTypes.length; i++)
- if ("person".equals(cTypes[i].getName())) {
- found = true;
- break;
- }
- assertTrue("Could not find the \"person\" complex type", found);
- // Set the bookmark
- SchemaBookmark sb = new SchemaBookmark("MyBookmark");
- cTypes[i].newCursor().setBookmark(sb);
- // Compile it into STS
- SchemaTypeSystem sts = XmlBeans.compileXsd(new XmlObject[]{parsed},
- XmlBeans.getBuiltinTypeSystem(), null);
- Assert.assertNotNull("Could not compile person.xsd", sts);
- SchemaType personType = sts.findType(QNameHelper.forLNS("person", "http://openuri.org/mytest"));
- Assert.assertNotNull("Could not find the \"person\" schema type", personType);
- // Check that the bookmark made it through
- Object val = personType.getUserData();
- Assert.assertNotNull("Schema user data not found!", val);
- Assert.assertEquals("MyBookmark", val);
- }
-
- @Test
- public void testSimple() throws Throwable {
- deltree(xbeanOutput("compile/scomp/simple"));
- // First, compile schema
-
- // First, compile schema
- File inputfile1 = xbeanCase("../../simple/person/person.xsd");
- File inputfile2 = xbeanCase("../../simple/person/simplec.xsd");
-
- File srcdir = xbeanOutput("simple/simpletypes/src");
+ //location of files under "cases folder"
+ private static final String fileLocation = CompileCommon.fileLocation;
+ private static final File outputroot = new File(fwroot, "build/test/output");
- File classesdir = xbeanOutput("compile/scomp/simple/simpletypes/classes");
- File outputjar = xbeanOutput("compile/scomp/simple/simpletypes.jar");
- SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
- params.setXsdFiles(new File[]{inputfile1, inputfile2});
- params.setSrcDir(srcdir);
- params.setClassesDir(classesdir);
- params.setOutputJar(outputjar);
- assertTrue("Build failed", SchemaCompiler.compile(params));
-
- // Then, compile java classes
- File javasrc = new File(CompileCommon.fileLocation+"/simple");
- File javaclasses = xbeanOutput("compile/scomp/simple/javaclasses");
- javaclasses.mkdirs();
- List<File> testcp = new ArrayList<File>(Arrays.asList(CodeGenUtil.systemClasspath()));
- testcp.add(outputjar);
- CodeGenUtil.externalCompile(Arrays.asList(javasrc), javaclasses, testcp.toArray(new File[0]), true);
-
- // Then run the test
- URLClassLoader childcl = new URLClassLoader(new URL[]{outputjar.toURI().toURL()}, CompilationTests.class.getClassLoader());
- Class<?> cl = childcl.loadClass("scomp.simple.SimplePersonTest");
- Result result = JUnitCore.runClasses(cl);
- assertEquals(0, result.getFailureCount());
- }
-
- @Test
- @Ignore
- public void testDownload() throws Throwable {
- deltree(xbeanOutput("compile/scomp/include"));
-
- {
- // First, compile schema without download and verify failure
- File srcdir = xbeanOutput("compile/scomp/include/shouldfail/src");
- File classesdir = xbeanOutput("compile/scomp/include/shouldfail/classes");
- File outputjar = xbeanOutput("compile/scomp/include/shouldfail.jar");
- SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
- params.setXsdFiles(new File[]{
- xbeanCase("compile/scomp/j2ee/j2ee_1_4.xsd")
- });
- params.setSrcDir(srcdir);
- params.setClassesDir(classesdir);
- params.setOutputJar(outputjar);
- assertTrue("Build should have failed", !SchemaCompiler.compile(params));
- assertTrue("Should not have created " + outputjar, !outputjar.exists());
- }
-
- {
- // now turn on download and verify success
- File srcdir = xbeanOutput("compile/scomp/include/shouldsucceed/src");
- File classesdir = xbeanOutput("compile/scomp/include/shouldsucceed/classes");
- File outputjar = xbeanOutput("compile/scomp/include/shouldsucceed.jar");
- SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
- params.setDownload(true);
- params.setXsdFiles(new File[]{
- xbeanCase("compile/scomp/j2ee/j2ee_1_4.xsd")
- });
- params.setSrcDir(srcdir);
- params.setClassesDir(classesdir);
- params.setOutputJar(outputjar);
- assertTrue("Build failed", SchemaCompiler.compile(params));
- assertTrue("Cannout find " + outputjar, outputjar.exists());
- }
- }
-
- @Test
- public void testPricequote() throws Throwable {
- deltree(xbeanOutput("compile/scomp/pricequote"));
- // First, compile schema
- File srcdir = xbeanOutput("compile/scomp/pricequote/src");
- File classesdir = xbeanOutput("compile/scomp/pricequote/classes");
- File outputjar = xbeanOutput("compile/scomp/pricequote/pricequote.jar");
- SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
- params.setXsdFiles(new File[]{xbeanCase("pricequote/PriceQuote.xsd")});
- params.setSrcDir(srcdir);
- params.setClassesDir(classesdir);
- params.setOutputJar(outputjar);
- assertTrue("Build failed " + fwroot, SchemaCompiler.compile(params));
- assertTrue("Cannout find " + outputjar, outputjar.exists());
- }
-
- private static String[] invalidSchemas = {
+ private static final String[] invalidSchemas = {
"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
" <xs:complexType name='base' final='extension'/>\n" +
" <xs:complexType name='ext'>\n" +
@@ -366,51 +132,312 @@
"</xs:schema>\n",
};
+
@Test
- public void testFinal() throws Throwable {
- SchemaDocument[] schemas = new SchemaDocument[invalidSchemas.length];
+ public void testJ2EE() {
+ deltree(xbeanOutput("compile/scomp/j2ee"));
+ // First, compile schema
+ File srcdir = xbeanOutput("compile/scomp/j2ee/j2eeconfigxml/src");
+ File classesdir = xbeanOutput("compile/scomp/j2ee/j2eeconfigxml/classes");
+ File outputjar = xbeanOutput("compile/scomp/j2ee/j2eeconfigxml.jar");
+ Parameters params = new Parameters();
+ params.setXsdFiles(
+ xbeanCase("j2ee/application-client_1_4.xsd"),
+ xbeanCase("j2ee/application_1_4.xsd"),
+ xbeanCase("j2ee/connector_1_5.xsd"),
+ xbeanCase("j2ee/ejb-jar_2_1.xsd"),
+ xbeanCase("j2ee/j2ee_1_4.xsd"),
+ xbeanCase("j2ee/jsp_2_0.xsd"),
+ xbeanCase("j2ee/web-app_2_4.xsd"),
+ xbeanCase("j2ee/XML.xsd"));
+ params.setSrcDir(srcdir);
+ params.setClassesDir(classesdir);
+ params.setOutputJar(outputjar);
+ params.setMdefNamespaces(Collections.singleton("http://java.sun.com/xml/ns/j2ee"));
+ List<XmlError> errors = new ArrayList<>();
+ params.setErrorListener(errors);
+ boolean result = SchemaCompiler.compile(params);
+ StringWriter message = new StringWriter();
+ if (!result)
+ dumpErrors(errors, new PrintWriter(message));
+ assertTrue("Build failed:" + message, result);
+ assertTrue("Cannot find " + outputjar, outputjar.exists());
+ }
- // Parse the invalid schema files
- for (int i = 0; i < invalidSchemas.length; i++)
- schemas[i] = SchemaDocument.Factory.parse(invalidSchemas[i]);
+ @Test
+ public void testIncrementalCompilation() throws IOException, XmlException {
+ File[] files = new File[]{
+ xbeanCase("incr/incr1.xsd"),
+ xbeanCase("incr/incr3.xsd"),
+ xbeanCase("incr/incr4.xsd"),
+ xbeanCase("incr/incr2.xsd"),
+ xbeanCase("incr/incr2-1.xsd")
+ };
+ int n = files.length;
+ SchemaDocument.Schema[] schemas = new SchemaDocument.Schema[n - 1];
+ SchemaTypeSystem system;
+ deltree(xbeanOutput("compile/scomp/incr"));
+ File out = xbeanOutput("compile/scomp/incr/out");
+ File outincr = xbeanOutput("compile/scomp/incr/outincr");
- // Now compile the invalid schemas, test that they fail
- for (int i = 0; i < schemas.length; i++) {
- try {
- XmlBeans.loadXsd(new XmlObject[]{schemas[i]});
- fail("Schema should have failed to compile:\n" + invalidSchemas[i]);
- } catch (XmlException success) {
- }
+ for (int i = 0; i < n - 2; i++)
+ schemas[i] = SchemaDocument.Factory.parse(files[i]).getSchema();
+ // Compile incrementally
+ // Initial compile
+ schemas[n - 2] = SchemaDocument.Factory.parse(files[n - 2]).getSchema();
+ List<XmlError> errors = new ArrayList<>();
+ XmlOptions options = (new XmlOptions()).setErrorListener(errors);
+ SchemaTypeSystem builtin = XmlBeans.getBuiltinTypeSystem();
+ system = XmlBeans.compileXsd(schemas, builtin, options);
+ Assert.assertNotNull("Compilation failed during inititial compile.", system);
+ System.out.println("-= Initial Compile =-");
+
+ for (int i = 0; i < system.globalTypes().length; i++) {
+ System.out.println("[" + i + "]-" + system.globalTypes()[i].getName());
+ }
+ for (int i = 0; i < system.globalAttributes().length; i++) {
+ System.out.println("[" + i + "]-" + system.globalAttributes()[i].getName());
+ }
+ for (int i = 0; i < system.globalElements().length; i++) {
+ System.out.println("[" + i + "]=" + system.globalElements()[i].getName());
}
- // Parse the valid schema files
- schemas = new SchemaDocument[validSchemas.length];
- for (int i = 0; i < validSchemas.length; i++)
- schemas[i] = SchemaDocument.Factory.parse(validSchemas[i]);
+ // Incremental compile
+ String url = schemas[n - 2].documentProperties().getSourceName();
+ SchemaDocument.Schema[] schemas1 = new SchemaDocument.Schema[1];
+ schemas1[0] = SchemaDocument.Factory.parse(files[n - 1]).getSchema();
+ schemas1[0].documentProperties().setSourceName(url);
+ errors.clear();
+ system = XmlBeans.compileXsd(system, schemas1, builtin, options);
+ Assert.assertNotNull("Compilation failed during incremental compile.", system);
+ SchemaCodeGenerator.saveTypeSystem(system, outincr, null, null, null);
+ System.out.println("-= Incremental Compile =-");
+ for (int i = 0; i < system.globalTypes().length; i++) {
+ System.out.println("[" + i + "]-" + system.globalTypes()[i].getName());
+ }
+ for (int i = 0; i < system.globalAttributes().length; i++) {
+ System.out.println("[" + i + "]-" + system.globalAttributes()[i].getName());
+ }
+ for (int i = 0; i < system.globalElements().length; i++) {
+ System.out.println("[" + i + "]=" + system.globalElements()[i].getName());
+ }
+ // Now compile non-incrementally for the purpose of comparing the result
+ errors.clear();
+ schemas[n - 2] = schemas1[0];
+ system = XmlBeans.compileXsd(schemas, builtin, options);
+ Assert.assertNotNull("Compilation failed during reference compile.", system);
+ Filer filer = new FilerImpl(out, null, null, false, false);
+ system.save(filer);
- // Compile the valid schemas. They should not fail
- for (int i = 0; i < schemas.length; i++) {
- try {
- XmlBeans.loadXsd(new XmlObject[]{schemas[i]});
- } catch (XmlException fail) {
- fail("Failed to compile schema:\n" + validSchemas[i]);
+ System.out.println("-= Sanity Compile =-");
+ for (int i = 0; i < system.globalTypes().length; i++) {
+ System.out.println("[" + i + "]-" + system.globalTypes()[i].getName());
+ }
+ for (int i = 0; i < system.globalAttributes().length; i++) {
+ System.out.println("[" + i + "]-" + system.globalAttributes()[i].getName());
+ }
+ for (int i = 0; i < system.globalElements().length; i++) {
+ System.out.println("[" + i + "]=" + system.globalElements()[i].getName());
+ }
+
+ // Compare the results
+ String oldPropValue = System.getProperty("xmlbeans.diff.diffIndex");
+ System.setProperty("xmlbeans.diff.diffIndex", "false");
+ errors.clear();
+ List<String> diffs = new ArrayList<>();
+ Diff.dirsAsTypeSystems(out, outincr, diffs);
+ System.setProperty("xmlbeans.diff.diffIndex", oldPropValue == null ? "true" : oldPropValue);
+ assertEquals("Differences encountered:" + String.join("\n", diffs), 0, diffs.size());
+ }
+
+ @Test
+ public void testSchemaBookmarks() throws XmlException, IOException {
+ File srcSchema = xbeanCase("../../simple/person/person.xsd");
+ // Parse
+ SchemaDocument.Schema parsed = SchemaDocument.Factory.parse(srcSchema).getSchema();
+ // Navigate to the type definition
+ TopLevelComplexType[] cTypes = parsed.getComplexTypeArray();
+ boolean found = false;
+ int i;
+ for (i = 0; i < cTypes.length; i++)
+ if ("person".equals(cTypes[i].getName())) {
+ found = true;
+ break;
+ }
+ assertTrue("Could not find the \"person\" complex type", found);
+ // Set the bookmark
+ SchemaBookmark sb = new SchemaBookmark("MyBookmark");
+ cTypes[i].newCursor().setBookmark(sb);
+ // Compile it into STS
+ SchemaTypeSystem sts = XmlBeans.compileXsd(new XmlObject[]{parsed},
+ XmlBeans.getBuiltinTypeSystem(), null);
+ Assert.assertNotNull("Could not compile person.xsd", sts);
+ SchemaType personType = sts.findType(QNameHelper.forLNS("person", "http://openuri.org/mytest"));
+ Assert.assertNotNull("Could not find the \"person\" schema type", personType);
+ // Check that the bookmark made it through
+ Object val = personType.getUserData();
+ Assert.assertNotNull("Schema user data not found!", val);
+ Assert.assertEquals("MyBookmark", val);
+ }
+
+ @Test
+ public void testSimple() throws MalformedURLException, ClassNotFoundException {
+ deltree(xbeanOutput("compile/scomp/simple"));
+ // First, compile schema
+
+ // First, compile schema
+ File inputfile1 = xbeanCase("../../simple/person/person.xsd");
+ File inputfile2 = xbeanCase("../../simple/person/simplec.xsd");
+
+ File srcdir = xbeanOutput("simple/simpletypes/src");
+
+
+ File classesdir = xbeanOutput("compile/scomp/simple/simpletypes/classes");
+ File outputjar = xbeanOutput("compile/scomp/simple/simpletypes.jar");
+ Parameters params = new Parameters();
+ params.setXsdFiles(inputfile1, inputfile2);
+ params.setSrcDir(srcdir);
+ params.setClassesDir(classesdir);
+ params.setOutputJar(outputjar);
+ assertTrue("Build failed", SchemaCompiler.compile(params));
+
+ // Then, compile java classes
+ File javasrc = new File(CompileCommon.fileLocation+"/simple");
+ File javaclasses = xbeanOutput("compile/scomp/simple/javaclasses");
+ javaclasses.mkdirs();
+ File[] testcp = Stream.concat(Stream.of(CodeGenUtil.systemClasspath()), Stream.of(outputjar)).toArray(File[]::new);
+ CodeGenUtil.externalCompile(singletonList(javasrc), javaclasses, testcp, true);
+
+ // Then run the test
+ URLClassLoader childcl = new URLClassLoader(new URL[]{outputjar.toURI().toURL()}, CompilationTests.class.getClassLoader());
+ Class<?> cl = childcl.loadClass("scomp.simple.SimplePersonTest");
+ Result result = JUnitCore.runClasses(cl);
+ assertEquals(0, result.getFailureCount());
+ }
+
+ @Test
+ @Ignore
+ public void testDownload() {
+ deltree(xbeanOutput("compile/scomp/include"));
+
+ {
+ // First, compile schema without download and verify failure
+ File srcdir = xbeanOutput("compile/scomp/include/shouldfail/src");
+ File classesdir = xbeanOutput("compile/scomp/include/shouldfail/classes");
+ File outputjar = xbeanOutput("compile/scomp/include/shouldfail.jar");
+ Parameters params = new Parameters();
+ params.setXsdFiles(xbeanCase("compile/scomp/j2ee/j2ee_1_4.xsd"));
+ params.setSrcDir(srcdir);
+ params.setClassesDir(classesdir);
+ params.setOutputJar(outputjar);
+ assertFalse("Build should have failed", SchemaCompiler.compile(params));
+ assertFalse("Should not have created " + outputjar, outputjar.exists());
+ }
+
+ {
+ // now turn on download and verify success
+ File srcdir = xbeanOutput("compile/scomp/include/shouldsucceed/src");
+ File classesdir = xbeanOutput("compile/scomp/include/shouldsucceed/classes");
+ File outputjar = xbeanOutput("compile/scomp/include/shouldsucceed.jar");
+ Parameters params = new Parameters();
+ params.setDownload(true);
+ params.setXsdFiles(xbeanCase("compile/scomp/j2ee/j2ee_1_4.xsd"));
+ params.setSrcDir(srcdir);
+ params.setClassesDir(classesdir);
+ params.setOutputJar(outputjar);
+ assertTrue("Build failed", SchemaCompiler.compile(params));
+ assertTrue("Cannout find " + outputjar, outputjar.exists());
+ }
+ }
+
+ @Test
+ public void testPricequote() {
+ deltree(xbeanOutput("compile/scomp/pricequote"));
+ // First, compile schema
+ File srcdir = xbeanOutput("compile/scomp/pricequote/src");
+ File classesdir = xbeanOutput("compile/scomp/pricequote/classes");
+ File outputjar = xbeanOutput("compile/scomp/pricequote/pricequote.jar");
+ Parameters params = new Parameters();
+ params.setXsdFiles(xbeanCase("pricequote/PriceQuote.xsd"));
+ params.setSrcDir(srcdir);
+ params.setClassesDir(classesdir);
+ params.setOutputJar(outputjar);
+ assertTrue("Build failed " + fwroot, SchemaCompiler.compile(params));
+ assertTrue("Cannout find " + outputjar, outputjar.exists());
+ }
+
+ @Test
+ public void testInvalid() throws XmlException {
+ for (String schemaFile : invalidSchemas) {
+ // Parse the invalid schema files
+ SchemaDocument schema = SchemaDocument.Factory.parse(schemaFile);
+ // Now compile the invalid schemas, test that they fail
+ assertThrows("Schema should have failed to compile:\n" + schemaFile, XmlException.class,
+ () -> XmlBeans.loadXsd(schema));
+ }
+ }
+
+ @Test
+ public void testValid() throws XmlException {
+ for (String schemaFile : validSchemas) {
+ // Parse the valid schema files
+ SchemaDocument schema = SchemaDocument.Factory.parse(schemaFile);
+ // Compile the valid schemas. They should not fail
+ SchemaTypeLoader xs = XmlBeans.loadXsd(schema);
+ assertNotNull(xs);
+ }
+ }
+
+ @Test
+ public void partials() throws InterruptedException, IOException {
+ String[] files = {"partials/RootDocument.java", "partials/impl/RootDocumentImpl.java"};
+ String[] templ = new String[files.length];
+ for (int i=0; i<files.length; i++) {
+ Path p = xbeanCase(files[i]).toPath();
+ templ[i] = new String(Files.readAllBytes(p), StandardCharsets.UTF_8);
+ }
+
+ deltree(xbeanOutput("compile/scomp/partials"));
+ File srcdir = xbeanOutput("compile/scomp/partials/src");
+ File classesdir = xbeanOutput("compile/scomp/partials/classes");
+ File outputjar = xbeanOutput("compile/scomp/partials/partialMethods.jar");
+ Parameters params = new Parameters();
+ params.setXsdFiles(xbeanCase("partials/partialMethods.xsd"));
+ params.setSrcDir(srcdir);
+ params.setClassesDir(classesdir);
+ params.setOutputJar(outputjar);
+ params.setName("Partials");
+
+ // exclude each bean method and compare with the template with that method excluded too
+ for (BeanMethod removeMethod : BeanMethod.values()) {
+ Set<BeanMethod> partialMethods = new HashSet<>(Arrays.asList(BeanMethod.values()));
+ partialMethods.remove(removeMethod);
+ params.setPartialMethods(partialMethods);
+ SchemaCompiler.compile(params);
+
+ for (int i=0; i<files.length; i++) {
+ Path p = new File(srcdir, files[i]).toPath();
+ String act = new String(Files.readAllBytes(p), StandardCharsets.UTF_8);
+ String exp = templ[i];
+ // remove marker + content
+ exp = exp.replaceAll("(?m)^.*<" + removeMethod + ">(?s).+?</" + removeMethod + ">$\\n", "");
+ // activate alternative content
+ exp = exp.replaceAll("(?m)^.*//.*</?" + removeMethod + "_ELSE>$\\n", "");
+ // remove other alternative content
+ exp = exp.replaceAll("(?m)^.*<[^>]+_ELSE>(?s).+?</[^>]+_ELSE>$\\n", "");
+ // remove unused markers
+ exp = exp.replaceAll("(?m)^.*//.*<.*>$\\n", "");
+ assertEquals(files[i] + " - " + removeMethod + " failed", exp, act);
}
}
}
+
//TESTENV:
- private static final File fwroot = new File(getRootFile());
- private static final File caseroot = new File(Common.getCaseLocation());
-
- //location of files under "cases folder"
- private static final String fileLocation = CompileCommon.fileLocation;
- private static final File outputroot = new File(fwroot, "build/test/output");
-
- private static void dumpErrors(List errors, PrintWriter out) {
+ private static void dumpErrors(List<XmlError> errors, PrintWriter out) {
// Display the errors
- for (int i = 0; i < errors.size(); i++) {
- XmlError error = (XmlError) errors.get(i);
+ for (XmlError error : errors) {
if (error.getSeverity() == XmlError.SEVERITY_ERROR)
out.println(error.toString());
}
@@ -427,29 +454,31 @@
return result;
}
- private static void deltree(File dir)
- throws InterruptedException {
- if (dir.exists()) {
- if (dir.isDirectory()) {
- String[] list = dir.list();
- for (int i = 0; i < list.length; i++)
- deltree(new File(dir, list[i]));
- }
- if (!dir.delete()) {
- for (int i = 0; i < 5; i++) {
- try {
- System.out.println("Sleep 1s and try do delete it again: " + dir.getCanonicalPath());
- } catch (IOException e) {
- e.printStackTrace(System.out);
- }
- Thread.currentThread().sleep(1000);
- if (dir.delete())
- return;
- }
+ private static void deltree(File dir) {
+ if (!dir.exists()) {
+ return;
+ }
- if (!dir.delete())
- throw new IllegalStateException("Could not delete " + dir);
+ if (dir.isDirectory()) {
+ String[] list = dir.list();
+ if (list != null) {
+ for (String s : list) {
+ deltree(new File(dir, s));
+ }
}
}
+
+ for (int i = 0; i < 5; i++) {
+ if (dir.delete()) {
+ return;
+ }
+ try {
+ System.out.println("Sleep 1s and try do delete it again: " + dir.getCanonicalPath());
+ Thread.sleep(1000);
+ } catch (InterruptedException|IOException ignored) {
+ }
+ }
+
+ throw new IllegalStateException("Could not delete " + dir);
}
}
diff --git a/src/test/java/compile/scomp/common/CompileTestBase.java b/src/test/java/compile/scomp/common/CompileTestBase.java
index 0acb25a..d011391 100644
--- a/src/test/java/compile/scomp/common/CompileTestBase.java
+++ b/src/test/java/compile/scomp/common/CompileTestBase.java
@@ -16,6 +16,7 @@
import org.apache.xmlbeans.*;
import org.apache.xmlbeans.impl.tool.Diff;
+import org.apache.xmlbeans.impl.tool.Parameters;
import org.apache.xmlbeans.impl.tool.SchemaCodeGenerator;
import org.apache.xmlbeans.impl.tool.SchemaCompiler;
import org.apache.xmlbeans.impl.xb.xsdschema.SchemaDocument;
@@ -109,23 +110,23 @@
return fList;
}
- protected SchemaCompiler.Parameters getCompilerParams() {
- SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
+ protected Parameters getCompilerParams() {
+ Parameters params = new Parameters();
params.setDownload(true);
params.setVerbose(true);
return params;
}
- protected SchemaCompiler.Parameters getIncrCompilerParams() {
- SchemaCompiler.Parameters params = getCompilerParams();
+ protected Parameters getIncrCompilerParams() {
+ Parameters params = getCompilerParams();
params.setIncrementalSrcGen(true);
return params;
}
protected boolean runCompiler(File[] schemas, String srcDir,
String classesDir, String outputDir,
- SchemaCompiler.Parameters params) {
+ Parameters params) {
File srcdir = xbeanOutput(srcDir);
File classesdir = xbeanOutput(classesDir);
diff --git a/src/test/java/compile/scomp/detailed/SchemaCompilerTests.java b/src/test/java/compile/scomp/detailed/SchemaCompilerTests.java
index e69f473..b39a389 100644
--- a/src/test/java/compile/scomp/detailed/SchemaCompilerTests.java
+++ b/src/test/java/compile/scomp/detailed/SchemaCompilerTests.java
@@ -15,6 +15,7 @@
package compile.scomp.detailed;
import common.Common;
+import org.apache.xmlbeans.impl.tool.Parameters;
import org.apache.xmlbeans.impl.tool.SchemaCompiler;
import org.junit.Test;
@@ -41,7 +42,7 @@
String testName)
{
List errors = new ArrayList();
- SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
+ Parameters params = new Parameters();
params.setXsdFiles(xsdFiles);
params.setErrorListener(errors);
params.setSrcDir(new File(schemaCompOutputDirPath + outputDirName + P + "src"));
@@ -57,7 +58,7 @@
public void testUnionRedefine()
{
File[] xsdFiles =
- new File[] { new File(scompTestFilesRoot + "union_initial.xsd"),
+ new File[] { new File(scompTestFilesRoot + "union_initial.xsd"),
new File(scompTestFilesRoot + "union_redefine.xsd") };
String outputDirName = "unionred";
String testname = "testUnionRedefine";
@@ -70,7 +71,7 @@
@Test
public void testEnumerationRedefine1()
{
- File[] xsdFiles =
+ File[] xsdFiles =
new File[] { new File(scompTestFilesRoot + "enum1.xsd_"),
new File(scompTestFilesRoot + "enum1_redefine.xsd_") };
String outputDirName = "enumRedef1";
@@ -84,7 +85,7 @@
@Test
public void testEnumerationRedefine2()
{
- File[] xsdFiles =
+ File[] xsdFiles =
new File[] { new File(scompTestFilesRoot + "enum2.xsd_"),
new File(scompTestFilesRoot + "enum2_redefine.xsd_") };
String outputDirName = "enumRedef2";
@@ -98,7 +99,7 @@
@Test
public void testEnumerationRedefine3()
{
- File[] xsdFiles =
+ File[] xsdFiles =
new File[] { new File(scompTestFilesRoot + "enum1.xsd_"),
new File(scompTestFilesRoot + "enum3.xsd_"),
new File(scompTestFilesRoot + "enum3_redefine.xsd_") };
@@ -126,7 +127,7 @@
String outputDirName = "methodsColide_jira205";
List errors = new ArrayList();
- SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
+ Parameters params = new Parameters();
params.setXsdFiles(xsdFiles);
params.setConfigFiles(configFiles);
params.setJavaFiles(javaFiles);
@@ -155,7 +156,7 @@
String outputDirName = "noExt";
List errors = new ArrayList();
- SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
+ Parameters params = new Parameters();
params.setXsdFiles(xsdFiles);
params.setConfigFiles(configFiles);
// no java files, if noExt flag doesn't work should fail for not finding the java files params.setJavaFiles(javaFiles);
diff --git a/src/test/java/misc/detailed/JiraRegression151_200Test.java b/src/test/java/misc/detailed/JiraRegression151_200Test.java
index ff9bffb..fe546fc 100644
--- a/src/test/java/misc/detailed/JiraRegression151_200Test.java
+++ b/src/test/java/misc/detailed/JiraRegression151_200Test.java
@@ -19,6 +19,7 @@
import net.eads.space.scoexml.test.TestExponentDocument;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.impl.tool.Parameters;
import org.apache.xmlbeans.impl.tool.SchemaCompiler;
import org.junit.Test;
@@ -91,7 +92,7 @@
List errors = new ArrayList();
// compile with nopvr, goes thro fine
- SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
+ Parameters params = new Parameters();
params.setXsdFiles(new File[]{new File(scompTestFilesRoot + "xmlbeans_184_vdx_data_V1.04.xsd_")});
params.setErrorListener(errors);
params.setSrcDir(schemaCompSrcDir);
diff --git a/src/test/java/misc/detailed/JiraRegression1_50Test.java b/src/test/java/misc/detailed/JiraRegression1_50Test.java
index 30b3f1e..2e16997 100644
--- a/src/test/java/misc/detailed/JiraRegression1_50Test.java
+++ b/src/test/java/misc/detailed/JiraRegression1_50Test.java
@@ -16,6 +16,7 @@
import misc.common.JiraTestBase;
import org.apache.xmlbeans.*;
+import org.apache.xmlbeans.impl.tool.Parameters;
import org.apache.xmlbeans.impl.tool.SchemaCompiler;
import org.apache.xmlbeans.impl.xb.xsdschema.SchemaDocument;
import org.junit.Ignore;
@@ -74,7 +75,7 @@
public void test_jira_xmlbeans04() {
List errors = new ArrayList();
- SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
+ Parameters params = new Parameters();
params.setXsdFiles(new File[]{new File(scompTestFilesRoot + "xmlbeans_04.xsd_")});
params.setErrorListener(errors);
params.setSrcDir(schemaCompSrcDir);
@@ -260,7 +261,7 @@
public void test_jira_xmlbeans34() throws Exception {
List errors = new ArrayList();
- SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
+ Parameters params = new Parameters();
params.setXsdFiles(new File[]{new File(scompTestFilesRoot + "xmlbeans_34b.xsd_")});
params.setErrorListener(errors);
params.setSrcDir(schemaCompSrcDir);
@@ -437,7 +438,7 @@
*/
public void test_jira_xmlbeans49() {
List errors = new ArrayList();
- SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
+ Parameters params = new Parameters();
params.setXsdFiles(new File[]{new File(scompTestFilesRoot + "xmlbeans_49.xsd_")});
params.setErrorListener(errors);
params.setSrcDir(schemaCompSrcDir);
diff --git a/src/test/java/misc/detailed/JiraRegression50_100Test.java b/src/test/java/misc/detailed/JiraRegression50_100Test.java
index 8507713..7a490e3 100644
--- a/src/test/java/misc/detailed/JiraRegression50_100Test.java
+++ b/src/test/java/misc/detailed/JiraRegression50_100Test.java
@@ -22,6 +22,7 @@
import net.orthogony.xml.sample.structure.ChildType;
import org.apache.beehive.netui.tools.testrecorder.x2004.session.RecorderSessionDocument;
import org.apache.xmlbeans.*;
+import org.apache.xmlbeans.impl.tool.Parameters;
import org.apache.xmlbeans.impl.tool.SchemaCompiler;
import org.apache.xmlbeans.impl.xb.xmlconfig.ConfigDocument;
import org.junit.Assert;
@@ -90,7 +91,7 @@
public void test_jira_xmlbeans54() throws Exception {
List errors = new ArrayList();
- SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
+ Parameters params = new Parameters();
params.setXsdFiles(new File[]{new File(scompTestFilesRoot + "xmlbeans_54.xsd_")});
params.setErrorListener(errors);
params.setSrcDir(schemaCompSrcDir);
@@ -165,7 +166,7 @@
File classDir = new File(outputDir + P + "classes");
classDir.mkdirs();
- SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
+ Parameters params = new Parameters();
params.setXsdFiles(new File[]{new File(JIRA_CASES + "xmlbeans_57.xml")});
params.setErrorListener(errorList);
params.setSrcDir(srcDir);
@@ -204,7 +205,7 @@
@Ignore("the url doesn't exist anymore ...")
public void test_jira_xmlbeans58() throws Exception {
List errors = new ArrayList();
- SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
+ Parameters params = new Parameters();
// old url has been retired
//params.setUrlFiles(new URL[]{new URL("http://devresource.hp.com/drc/specifications/wsrf/interfaces/WS-BrokeredNotification-1-0.wsdl")});
@@ -237,7 +238,7 @@
File classDir = new File(outputDir + P + "classes");
classDir.mkdirs();
- SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
+ Parameters params = new Parameters();
params.setWsdlFiles(new File[]{new File(JIRA_CASES + "xmlbeans_62.xml")});
params.setErrorListener(errorList);
params.setSrcDir(srcDir);
@@ -582,7 +583,7 @@
@Test
public void test_jira_xmlbeans88() throws Exception {
List errors = new ArrayList();
- SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
+ Parameters params = new Parameters();
params.setUrlFiles(new URL[]{new URL("http://developer.ebay.com/webservices/latest/eBaySvc.wsdl")});
params.setErrorListener(errors);
diff --git a/src/test/java/misc/detailed/JiraRegressionSchemaCompilerTest.java b/src/test/java/misc/detailed/JiraRegressionSchemaCompilerTest.java
index 1ccfef2..772902d 100644
--- a/src/test/java/misc/detailed/JiraRegressionSchemaCompilerTest.java
+++ b/src/test/java/misc/detailed/JiraRegressionSchemaCompilerTest.java
@@ -16,6 +16,7 @@
import misc.common.JiraTestBase;
import org.apache.xmlbeans.XmlError;
+import org.apache.xmlbeans.impl.tool.Parameters;
import org.apache.xmlbeans.impl.tool.SchemaCompiler;
import org.junit.Test;
@@ -34,7 +35,7 @@
{
System.out.println(xsdFiles[0].getAbsolutePath());
List errors = new ArrayList();
- SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
+ Parameters params = new Parameters();
params.setXsdFiles(xsdFiles);
params.setErrorListener(errors);
params.setSrcDir(new File(schemaCompOutputDirPath + outputDirName + P + "src"));
@@ -80,7 +81,7 @@
@Test
public void test_jira_xmlbeans239()
{
- /* complexType with complexContent extending base type with
+ /* complexType with complexContent extending base type with
simpleContent is valid */
File[] xsdFiles =
new File[] { new File(scompTestFilesRoot + "xmlbeans_239a.xsd_") };
diff --git a/src/test/java/misc/detailed/JiraRegressionTest101_150.java b/src/test/java/misc/detailed/JiraRegressionTest101_150.java
index 23d7fc4..7d26fae 100644
--- a/src/test/java/misc/detailed/JiraRegressionTest101_150.java
+++ b/src/test/java/misc/detailed/JiraRegressionTest101_150.java
@@ -18,6 +18,7 @@
import misc.common.JiraTestBase;
import org.apache.xmlbeans.XmlError;
import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.impl.tool.Parameters;
import org.apache.xmlbeans.impl.tool.SchemaCompiler;
import org.junit.Test;
@@ -39,7 +40,7 @@
@Test
public void test_jira_xmlbeans102a() throws Exception{
// set the parameters similar to those in the bug
- SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
+ Parameters params = new Parameters();
params.setXsdFiles(new File[]{new File(JIRA_CASES + "xmlbeans_102.xsd")});
params.setOutputJar(new File(outputroot+P+"xmlbeans_102.jar"));
File outputDir = new File(outputroot + P + "xmlbeans_102");
@@ -62,7 +63,7 @@
public void test_jira_xmlbeans102b() {
//Assert.fail("test_jira_xmlbeans102: Infinite loop after completion of parsing" );
- SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
+ Parameters params = new Parameters();
params.setOutputJar(new File(schemaCompOutputDirPath + "jira102.jar"));
params.setClassesDir(schemaCompClassesDir);
diff --git a/src/test/resources/xbean/compile/scomp/partials/RootDocument.java b/src/test/resources/xbean/compile/scomp/partials/RootDocument.java
new file mode 100644
index 0000000..e53fa21
--- /dev/null
+++ b/src/test/resources/xbean/compile/scomp/partials/RootDocument.java
@@ -0,0 +1,340 @@
+/*
+ * An XML document type.
+ * Localname: root
+ * Namespace: partials
+ * Java type: partials.RootDocument
+ *
+ * Automatically generated - do not modify.
+ */
+package partials;
+
+import org.apache.xmlbeans.impl.schema.ElementFactory;
+import org.apache.xmlbeans.impl.schema.AbstractDocumentFactory;
+import org.apache.xmlbeans.impl.schema.DocumentFactory;
+import org.apache.xmlbeans.impl.schema.SimpleTypeFactory;
+
+
+/**
+ * A document containing one root(@partials) element.
+ *
+ * This is a complex type.
+ */
+public interface RootDocument extends org.apache.xmlbeans.XmlObject
+{
+ DocumentFactory<partials.RootDocument> Factory = new DocumentFactory<>(org.apache.xmlbeans.metadata.system.Partials.TypeSystemHolder.typeSystem, "rootc8d7doctype");
+ org.apache.xmlbeans.SchemaType type = Factory.getType();
+
+// <GET>
+
+ /**
+ * Gets the "root" element
+ */
+ partials.RootDocument.Root getRoot();
+// </GET>
+// <SET>
+
+ /**
+ * Sets the "root" element
+ */
+ void setRoot(partials.RootDocument.Root root);
+// </SET>
+// <ADD_NEW>
+
+ /**
+ * Appends and returns a new empty "root" element
+ */
+ partials.RootDocument.Root addNewRoot();
+// </ADD_NEW>
+
+ /**
+ * An XML root(@partials).
+ *
+ * This is a complex type.
+ */
+ public interface Root extends org.apache.xmlbeans.XmlObject
+ {
+ ElementFactory<partials.RootDocument.Root> Factory = new ElementFactory<>(org.apache.xmlbeans.metadata.system.Partials.TypeSystemHolder.typeSystem, "root8a55elemtype");
+ org.apache.xmlbeans.SchemaType type = Factory.getType();
+
+// <GET>
+
+ /**
+ * Gets the "single" element
+ */
+ java.math.BigDecimal getSingle();
+// </GET>
+// <XGET>
+
+ /**
+ * Gets (as xml) the "single" element
+ */
+ org.apache.xmlbeans.XmlDecimal xgetSingle();
+// </XGET>
+// <IS_NIL>
+
+ /**
+ * Tests for nil "single" element
+ */
+ boolean isNilSingle();
+// </IS_NIL>
+// <IS_SET>
+
+ /**
+ * True if has "single" element
+ */
+ boolean isSetSingle();
+// </IS_SET>
+// <SET>
+
+ /**
+ * Sets the "single" element
+ */
+ void setSingle(java.math.BigDecimal single);
+// </SET>
+// <XSET>
+
+ /**
+ * Sets (as xml) the "single" element
+ */
+ void xsetSingle(org.apache.xmlbeans.XmlDecimal single);
+// </XSET>
+// <SET_NIL>
+
+ /**
+ * Nils the "single" element
+ */
+ void setNilSingle();
+// </SET_NIL>
+// <UNSET>
+
+ /**
+ * Unsets the "single" element
+ */
+ void unsetSingle();
+// </UNSET>
+// <GET>
+
+ /**
+ * Gets the "complex" element
+ */
+ partials.XmlBeanchen getComplex();
+// </GET>
+// <IS_SET>
+
+ /**
+ * True if has "complex" element
+ */
+ boolean isSetComplex();
+// </IS_SET>
+// <SET>
+
+ /**
+ * Sets the "complex" element
+ */
+ void setComplex(partials.XmlBeanchen complex);
+// </SET>
+// <ADD_NEW>
+
+ /**
+ * Appends and returns a new empty "complex" element
+ */
+ partials.XmlBeanchen addNewComplex();
+// </ADD_NEW>
+// <UNSET>
+
+ /**
+ * Unsets the "complex" element
+ */
+ void unsetComplex();
+// </UNSET>
+// <GET_LIST>
+
+ /**
+ * Gets a List of "primitiveList" elements
+ */
+ java.util.List<java.math.BigDecimal> getPrimitiveListList();
+// </GET_LIST>
+// <GET_ARRAY>
+
+ /**
+ * Gets array of all "primitiveList" elements
+ */
+ java.math.BigDecimal[] getPrimitiveListArray();
+// </GET_ARRAY>
+// <GET_IDX>
+
+ /**
+ * Gets ith "primitiveList" element
+ */
+ java.math.BigDecimal getPrimitiveListArray(int i);
+// </GET_IDX>
+// <XGET_LIST>
+
+ /**
+ * Gets (as xml) a List of "primitiveList" elements
+ */
+ java.util.List<org.apache.xmlbeans.XmlDecimal> xgetPrimitiveListList();
+// </XGET_LIST>
+// <XGET_ARRAY>
+
+ /**
+ * Gets (as xml) array of all "primitiveList" elements
+ */
+ org.apache.xmlbeans.XmlDecimal[] xgetPrimitiveListArray();
+// </XGET_ARRAY>
+// <XGET_IDX>
+
+ /**
+ * Gets (as xml) ith "primitiveList" element
+ */
+ org.apache.xmlbeans.XmlDecimal xgetPrimitiveListArray(int i);
+// </XGET_IDX>
+// <IS_NIL_IDX>
+
+ /**
+ * Tests for nil ith "primitiveList" element
+ */
+ boolean isNilPrimitiveListArray(int i);
+// </IS_NIL_IDX>
+// <SIZE_OF_ARRAY>
+
+ /**
+ * Returns number of "primitiveList" element
+ */
+ int sizeOfPrimitiveListArray();
+// </SIZE_OF_ARRAY>
+// <SET_ARRAY>
+
+ /**
+ * Sets array of all "primitiveList" element
+ */
+ void setPrimitiveListArray(java.math.BigDecimal[] primitiveListArray);
+// </SET_ARRAY>
+// <SET_IDX>
+
+ /**
+ * Sets ith "primitiveList" element
+ */
+ void setPrimitiveListArray(int i, java.math.BigDecimal primitiveList);
+// </SET_IDX>
+// <XSET_ARRAY>
+
+ /**
+ * Sets (as xml) array of all "primitiveList" element
+ */
+ void xsetPrimitiveListArray(org.apache.xmlbeans.XmlDecimal[] primitiveListArray);
+// </XSET_ARRAY>
+// <XSET_IDX>
+
+ /**
+ * Sets (as xml) ith "primitiveList" element
+ */
+ void xsetPrimitiveListArray(int i, org.apache.xmlbeans.XmlDecimal primitiveList);
+// </XSET_IDX>
+// <SET_NIL_IDX>
+
+ /**
+ * Nils the ith "primitiveList" element
+ */
+ void setNilPrimitiveListArray(int i);
+// </SET_NIL_IDX>
+// <INSERT_IDX>
+
+ /**
+ * Inserts the value as the ith "primitiveList" element
+ */
+ void insertPrimitiveList(int i, java.math.BigDecimal primitiveList);
+// </INSERT_IDX>
+// <ADD>
+
+ /**
+ * Appends the value as the last "primitiveList" element
+ */
+ void addPrimitiveList(java.math.BigDecimal primitiveList);
+// </ADD>
+// <INSERT_NEW_IDX>
+
+ /**
+ * Inserts and returns a new empty value (as xml) as the ith "primitiveList" element
+ */
+ org.apache.xmlbeans.XmlDecimal insertNewPrimitiveList(int i);
+// </INSERT_NEW_IDX>
+// <ADD_NEW>
+
+ /**
+ * Appends and returns a new empty value (as xml) as the last "primitiveList" element
+ */
+ org.apache.xmlbeans.XmlDecimal addNewPrimitiveList();
+// </ADD_NEW>
+// <REMOVE_IDX>
+
+ /**
+ * Removes the ith "primitiveList" element
+ */
+ void removePrimitiveList(int i);
+// </REMOVE_IDX>
+// <GET_LIST>
+
+ /**
+ * Gets a List of "complexList" elements
+ */
+ java.util.List<partials.XmlBeanchen> getComplexListList();
+// </GET_LIST>
+// <GET_ARRAY>
+
+ /**
+ * Gets array of all "complexList" elements
+ */
+ partials.XmlBeanchen[] getComplexListArray();
+// </GET_ARRAY>
+// <GET_IDX>
+
+ /**
+ * Gets ith "complexList" element
+ */
+ partials.XmlBeanchen getComplexListArray(int i);
+// </GET_IDX>
+// <SIZE_OF_ARRAY>
+
+ /**
+ * Returns number of "complexList" element
+ */
+ int sizeOfComplexListArray();
+// </SIZE_OF_ARRAY>
+// <SET_ARRAY>
+
+ /**
+ * Sets array of all "complexList" element
+ */
+ void setComplexListArray(partials.XmlBeanchen[] complexListArray);
+// </SET_ARRAY>
+// <SET_IDX>
+
+ /**
+ * Sets ith "complexList" element
+ */
+ void setComplexListArray(int i, partials.XmlBeanchen complexList);
+// </SET_IDX>
+// <INSERT_NEW_IDX>
+
+ /**
+ * Inserts and returns a new empty value (as xml) as the ith "complexList" element
+ */
+ partials.XmlBeanchen insertNewComplexList(int i);
+// </INSERT_NEW_IDX>
+// <ADD_NEW>
+
+ /**
+ * Appends and returns a new empty value (as xml) as the last "complexList" element
+ */
+ partials.XmlBeanchen addNewComplexList();
+// </ADD_NEW>
+// <REMOVE_IDX>
+
+ /**
+ * Removes the ith "complexList" element
+ */
+ void removeComplexList(int i);
+// </REMOVE_IDX>
+ }
+}
diff --git a/src/test/resources/xbean/compile/scomp/partials/impl/RootDocumentImpl.java b/src/test/resources/xbean/compile/scomp/partials/impl/RootDocumentImpl.java
new file mode 100644
index 0000000..dec9860
--- /dev/null
+++ b/src/test/resources/xbean/compile/scomp/partials/impl/RootDocumentImpl.java
@@ -0,0 +1,804 @@
+/*
+ * An XML document type.
+ * Localname: root
+ * Namespace: partials
+ * Java type: partials.RootDocument
+ *
+ * Automatically generated - do not modify.
+ */
+package partials.impl;
+
+import javax.xml.namespace.QName;
+import org.apache.xmlbeans.QNameSet;
+
+/**
+ * A document containing one root(@partials) element.
+ *
+ * This is a complex type.
+ */
+public class RootDocumentImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements partials.RootDocument {
+ private static final long serialVersionUID = 1L;
+
+ public RootDocumentImpl(org.apache.xmlbeans.SchemaType sType) {
+ super(sType);
+ }
+
+ private static final QName[] PROPERTY_QNAME = {
+ new QName("partials", "root"),
+ };
+
+// <GET>
+
+ /**
+ * Gets the "root" element
+ */
+ @Override
+ public partials.RootDocument.Root getRoot() {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ partials.RootDocument.Root target = null;
+ target = (partials.RootDocument.Root)get_store().find_element_user(PROPERTY_QNAME[0], 0);
+ if (target == null) {
+ return null;
+ }
+ return target;
+ }
+ }
+// </GET>
+// <SET>
+
+ /**
+ * Sets the "root" element
+ */
+ @Override
+ public void setRoot(partials.RootDocument.Root root) {
+ generatedSetterHelperImpl(root, PROPERTY_QNAME[0], 0, org.apache.xmlbeans.impl.values.XmlObjectBase.KIND_SETTERHELPER_SINGLETON);
+ }
+// </SET>
+// <ADD_NEW>
+
+ /**
+ * Appends and returns a new empty "root" element
+ */
+ @Override
+ public partials.RootDocument.Root addNewRoot() {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ partials.RootDocument.Root target = null;
+ target = (partials.RootDocument.Root)get_store().add_element_user(PROPERTY_QNAME[0]);
+ return target;
+ }
+ }
+// </ADD_NEW>
+ /**
+ * An XML root(@partials).
+ *
+ * This is a complex type.
+ */
+ public static class RootImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements partials.RootDocument.Root {
+ private static final long serialVersionUID = 1L;
+
+ public RootImpl(org.apache.xmlbeans.SchemaType sType) {
+ super(sType);
+ }
+
+ private static final QName[] PROPERTY_QNAME = {
+ new QName("partials", "single"),
+ new QName("partials", "complex"),
+ new QName("partials", "primitiveList"),
+ new QName("partials", "complexList"),
+ };
+
+// <GET>
+
+ /**
+ * Gets the "single" element
+ */
+ @Override
+ public java.math.BigDecimal getSingle() {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ org.apache.xmlbeans.SimpleValue target = null;
+ target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(PROPERTY_QNAME[0], 0);
+ if (target == null) {
+ return null;
+ }
+ return target.getBigDecimalValue();
+ }
+ }
+// </GET>
+// <XGET>
+
+ /**
+ * Gets (as xml) the "single" element
+ */
+ @Override
+ public org.apache.xmlbeans.XmlDecimal xgetSingle() {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ org.apache.xmlbeans.XmlDecimal target = null;
+ target = (org.apache.xmlbeans.XmlDecimal)get_store().find_element_user(PROPERTY_QNAME[0], 0);
+ return target;
+ }
+ }
+// </XGET>
+// <IS_NIL>
+
+ /**
+ * Tests for nil "single" element
+ */
+ @Override
+ public boolean isNilSingle() {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ org.apache.xmlbeans.XmlDecimal target = null;
+ target = (org.apache.xmlbeans.XmlDecimal)get_store().find_element_user(PROPERTY_QNAME[0], 0);
+ if (target == null) return false;
+ return target.isNil();
+ }
+ }
+// </IS_NIL>
+// <IS_SET>
+
+ /**
+ * True if has "single" element
+ */
+ @Override
+ public boolean isSetSingle() {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ return get_store().count_elements(PROPERTY_QNAME[0]) != 0;
+ }
+ }
+// </IS_SET>
+// <SET>
+
+ /**
+ * Sets the "single" element
+ */
+ @Override
+ public void setSingle(java.math.BigDecimal single) {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ org.apache.xmlbeans.SimpleValue target = null;
+ target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(PROPERTY_QNAME[0], 0);
+ if (target == null) {
+ target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(PROPERTY_QNAME[0]);
+ }
+ target.setBigDecimalValue(single);
+ }
+ }
+// </SET>
+// <XSET>
+
+ /**
+ * Sets (as xml) the "single" element
+ */
+ @Override
+ public void xsetSingle(org.apache.xmlbeans.XmlDecimal single) {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ org.apache.xmlbeans.XmlDecimal target = null;
+ target = (org.apache.xmlbeans.XmlDecimal)get_store().find_element_user(PROPERTY_QNAME[0], 0);
+ if (target == null) {
+ target = (org.apache.xmlbeans.XmlDecimal)get_store().add_element_user(PROPERTY_QNAME[0]);
+ }
+ target.set(single);
+ }
+ }
+// </XSET>
+// <SET_NIL>
+
+ /**
+ * Nils the "single" element
+ */
+ @Override
+ public void setNilSingle() {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ org.apache.xmlbeans.XmlDecimal target = null;
+ target = (org.apache.xmlbeans.XmlDecimal)get_store().find_element_user(PROPERTY_QNAME[0], 0);
+ if (target == null) {
+ target = (org.apache.xmlbeans.XmlDecimal)get_store().add_element_user(PROPERTY_QNAME[0]);
+ }
+ target.setNil();
+ }
+ }
+// </SET_NIL>
+// <UNSET>
+
+ /**
+ * Unsets the "single" element
+ */
+ @Override
+ public void unsetSingle() {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ get_store().remove_element(PROPERTY_QNAME[0], 0);
+ }
+ }
+// </UNSET>
+// <GET>
+
+ /**
+ * Gets the "complex" element
+ */
+ @Override
+ public partials.XmlBeanchen getComplex() {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ partials.XmlBeanchen target = null;
+ target = (partials.XmlBeanchen)get_store().find_element_user(PROPERTY_QNAME[1], 0);
+ if (target == null) {
+ return null;
+ }
+ return target;
+ }
+ }
+// </GET>
+// <IS_SET>
+
+ /**
+ * True if has "complex" element
+ */
+ @Override
+ public boolean isSetComplex() {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ return get_store().count_elements(PROPERTY_QNAME[1]) != 0;
+ }
+ }
+// </IS_SET>
+// <SET>
+
+ /**
+ * Sets the "complex" element
+ */
+ @Override
+ public void setComplex(partials.XmlBeanchen complex) {
+ generatedSetterHelperImpl(complex, PROPERTY_QNAME[1], 0, org.apache.xmlbeans.impl.values.XmlObjectBase.KIND_SETTERHELPER_SINGLETON);
+ }
+// </SET>
+// <ADD_NEW>
+
+ /**
+ * Appends and returns a new empty "complex" element
+ */
+ @Override
+ public partials.XmlBeanchen addNewComplex() {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ partials.XmlBeanchen target = null;
+ target = (partials.XmlBeanchen)get_store().add_element_user(PROPERTY_QNAME[1]);
+ return target;
+ }
+ }
+// </ADD_NEW>
+// <UNSET>
+
+ /**
+ * Unsets the "complex" element
+ */
+ @Override
+ public void unsetComplex() {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ get_store().remove_element(PROPERTY_QNAME[1], 0);
+ }
+ }
+// </UNSET>
+// <GET_LIST>
+
+ /**
+ * Gets a List of "primitiveList" elements
+ */
+ @Override
+ public java.util.List<java.math.BigDecimal> getPrimitiveListList() {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ return new org.apache.xmlbeans.impl.values.JavaListObject<>(
+// <GET_IDX>
+ this::getPrimitiveListArray,
+// </GET_IDX>
+// <GET_IDX_ELSE>
+ null,
+// </GET_IDX_ELSE>
+// <SET_IDX>
+ this::setPrimitiveListArray,
+// </SET_IDX>
+// <SET_IDX_ELSE>
+ null,
+// </SET_IDX_ELSE>
+// <INSERT_IDX>
+ this::insertPrimitiveList,
+// </INSERT_IDX>
+// <INSERT_IDX_ELSE>
+ null,
+// </INSERT_IDX_ELSE>
+// <REMOVE_IDX>
+ this::removePrimitiveList,
+// </REMOVE_IDX>
+// <REMOVE_IDX_ELSE>
+ null,
+// </REMOVE_IDX_ELSE>
+// <SIZE_OF_ARRAY>
+ this::sizeOfPrimitiveListArray
+// </SIZE_OF_ARRAY>
+// <SIZE_OF_ARRAY_ELSE>
+ null
+// </SIZE_OF_ARRAY_ELSE>
+ );
+ }
+ }
+// </GET_LIST>
+// <GET_ARRAY>
+
+ /**
+ * Gets array of all "primitiveList" elements
+ */
+ @Override
+ public java.math.BigDecimal[] getPrimitiveListArray() {
+ return getObjectArray(PROPERTY_QNAME[2], org.apache.xmlbeans.SimpleValue::getBigDecimalValue, java.math.BigDecimal[]::new);
+ }
+// </GET_ARRAY>
+// <GET_IDX>
+
+ /**
+ * Gets ith "primitiveList" element
+ */
+ @Override
+ public java.math.BigDecimal getPrimitiveListArray(int i) {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ org.apache.xmlbeans.SimpleValue target = null;
+ target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(PROPERTY_QNAME[2], i);
+ if (target == null) {
+ throw new IndexOutOfBoundsException();
+ }
+ return target.getBigDecimalValue();
+ }
+ }
+// </GET_IDX>
+// <XGET_LIST>
+
+ /**
+ * Gets (as xml) a List of "primitiveList" elements
+ */
+ @Override
+ public java.util.List<org.apache.xmlbeans.XmlDecimal> xgetPrimitiveListList() {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ return new org.apache.xmlbeans.impl.values.JavaListXmlObject<>(
+// <XGET_IDX>
+ this::xgetPrimitiveListArray,
+// </XGET_IDX>
+// <XGET_IDX_ELSE>
+ null,
+// </XGET_IDX_ELSE>
+// <XSET_IDX>
+ this::xsetPrimitiveListArray,
+// </XSET_IDX>
+// <XSET_IDX_ELSE>
+ null,
+// </XSET_IDX_ELSE>
+// <INSERT_NEW_IDX>
+ this::insertNewPrimitiveList,
+// </INSERT_NEW_IDX>
+// <INSERT_NEW_IDX_ELSE>
+ null,
+// </INSERT_NEW_IDX_ELSE>
+// <REMOVE_IDX>
+ this::removePrimitiveList,
+// </REMOVE_IDX>
+// <REMOVE_IDX_ELSE>
+ null,
+// </REMOVE_IDX_ELSE>
+// <SIZE_OF_ARRAY>
+ this::sizeOfPrimitiveListArray
+// </SIZE_OF_ARRAY>
+// <SIZE_OF_ARRAY_ELSE>
+ null
+// </SIZE_OF_ARRAY_ELSE>
+ );
+ }
+ }
+// </XGET_LIST>
+// <XGET_ARRAY>
+
+ /**
+ * Gets (as xml) array of all "primitiveList" elements
+ */
+ @Override
+ public org.apache.xmlbeans.XmlDecimal[] xgetPrimitiveListArray() {
+ return xgetArray(PROPERTY_QNAME[2], org.apache.xmlbeans.XmlDecimal[]::new);
+ }
+// </XGET_ARRAY>
+// <XGET_IDX>
+
+ /**
+ * Gets (as xml) ith "primitiveList" element
+ */
+ @Override
+ public org.apache.xmlbeans.XmlDecimal xgetPrimitiveListArray(int i) {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ org.apache.xmlbeans.XmlDecimal target = null;
+ target = (org.apache.xmlbeans.XmlDecimal)get_store().find_element_user(PROPERTY_QNAME[2], i);
+ if (target == null) {
+ throw new IndexOutOfBoundsException();
+ }
+ return target;
+ }
+ }
+// </XGET_IDX>
+// <IS_NIL_IDX>
+
+ /**
+ * Tests for nil ith "primitiveList" element
+ */
+ @Override
+ public boolean isNilPrimitiveListArray(int i) {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ org.apache.xmlbeans.XmlDecimal target = null;
+ target = (org.apache.xmlbeans.XmlDecimal)get_store().find_element_user(PROPERTY_QNAME[2], i);
+ if (target == null) {
+ throw new IndexOutOfBoundsException();
+ }
+ return target.isNil();
+ }
+ }
+// </IS_NIL_IDX>
+// <SIZE_OF_ARRAY>
+
+ /**
+ * Returns number of "primitiveList" element
+ */
+ @Override
+ public int sizeOfPrimitiveListArray() {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ return get_store().count_elements(PROPERTY_QNAME[2]);
+ }
+ }
+// </SIZE_OF_ARRAY>
+// <SET_ARRAY>
+
+ /**
+ * Sets array of all "primitiveList" element
+ */
+ @Override
+ public void setPrimitiveListArray(java.math.BigDecimal[] primitiveListArray) {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ arraySetterHelper(primitiveListArray, PROPERTY_QNAME[2]);
+ }
+ }
+// </SET_ARRAY>
+// <SET_IDX>
+
+ /**
+ * Sets ith "primitiveList" element
+ */
+ @Override
+ public void setPrimitiveListArray(int i, java.math.BigDecimal primitiveList) {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ org.apache.xmlbeans.SimpleValue target = null;
+ target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(PROPERTY_QNAME[2], i);
+ if (target == null) {
+ throw new IndexOutOfBoundsException();
+ }
+ target.setBigDecimalValue(primitiveList);
+ }
+ }
+// </SET_IDX>
+// <XSET_ARRAY>
+
+ /**
+ * Sets (as xml) array of all "primitiveList" element
+ */
+ @Override
+ public void xsetPrimitiveListArray(org.apache.xmlbeans.XmlDecimal[]primitiveListArray) {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ arraySetterHelper(primitiveListArray, PROPERTY_QNAME[2]);
+ }
+ }
+// </XSET_ARRAY>
+// <XSET_IDX>
+
+ /**
+ * Sets (as xml) ith "primitiveList" element
+ */
+ @Override
+ public void xsetPrimitiveListArray(int i, org.apache.xmlbeans.XmlDecimal primitiveList) {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ org.apache.xmlbeans.XmlDecimal target = null;
+ target = (org.apache.xmlbeans.XmlDecimal)get_store().find_element_user(PROPERTY_QNAME[2], i);
+ if (target == null) {
+ throw new IndexOutOfBoundsException();
+ }
+ target.set(primitiveList);
+ }
+ }
+// </XSET_IDX>
+// <SET_NIL_IDX>
+
+ /**
+ * Nils the ith "primitiveList" element
+ */
+ @Override
+ public void setNilPrimitiveListArray(int i) {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ org.apache.xmlbeans.XmlDecimal target = null;
+ target = (org.apache.xmlbeans.XmlDecimal)get_store().find_element_user(PROPERTY_QNAME[2], i);
+ if (target == null) {
+ throw new IndexOutOfBoundsException();
+ }
+ target.setNil();
+ }
+ }
+// </SET_NIL_IDX>
+// <INSERT_IDX>
+
+ /**
+ * Inserts the value as the ith "primitiveList" element
+ */
+ @Override
+ public void insertPrimitiveList(int i, java.math.BigDecimal primitiveList) {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ org.apache.xmlbeans.SimpleValue target =
+ (org.apache.xmlbeans.SimpleValue)get_store().insert_element_user(PROPERTY_QNAME[2], i);
+ target.setBigDecimalValue(primitiveList);
+ }
+ }
+// </INSERT_IDX>
+// <ADD>
+
+ /**
+ * Appends the value as the last "primitiveList" element
+ */
+ @Override
+ public void addPrimitiveList(java.math.BigDecimal primitiveList) {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ org.apache.xmlbeans.SimpleValue target = null;
+ target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(PROPERTY_QNAME[2]);
+ target.setBigDecimalValue(primitiveList);
+ }
+ }
+// </ADD>
+// <INSERT_NEW_IDX>
+
+ /**
+ * Inserts and returns a new empty value (as xml) as the ith "primitiveList" element
+ */
+ @Override
+ public org.apache.xmlbeans.XmlDecimal insertNewPrimitiveList(int i) {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ org.apache.xmlbeans.XmlDecimal target = null;
+ target = (org.apache.xmlbeans.XmlDecimal)get_store().insert_element_user(PROPERTY_QNAME[2], i);
+ return target;
+ }
+ }
+// </INSERT_NEW_IDX>
+// <ADD_NEW>
+
+ /**
+ * Appends and returns a new empty value (as xml) as the last "primitiveList" element
+ */
+ @Override
+ public org.apache.xmlbeans.XmlDecimal addNewPrimitiveList() {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ org.apache.xmlbeans.XmlDecimal target = null;
+ target = (org.apache.xmlbeans.XmlDecimal)get_store().add_element_user(PROPERTY_QNAME[2]);
+ return target;
+ }
+ }
+// </ADD_NEW>
+// <REMOVE_IDX>
+
+ /**
+ * Removes the ith "primitiveList" element
+ */
+ @Override
+ public void removePrimitiveList(int i) {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ get_store().remove_element(PROPERTY_QNAME[2], i);
+ }
+ }
+// </REMOVE_IDX>
+// <GET_LIST>
+
+ /**
+ * Gets a List of "complexList" elements
+ */
+ @Override
+ public java.util.List<partials.XmlBeanchen> getComplexListList() {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ return new org.apache.xmlbeans.impl.values.JavaListXmlObject<>(
+// <GET_IDX>
+ this::getComplexListArray,
+// </GET_IDX>
+// <GET_IDX_ELSE>
+ null,
+// </GET_IDX_ELSE>
+// <SET_IDX>
+ this::setComplexListArray,
+// </SET_IDX>
+// <SET_IDX_ELSE>
+ null,
+// </SET_IDX_ELSE>
+// <INSERT_NEW_IDX>
+ this::insertNewComplexList,
+// </INSERT_NEW_IDX>
+// <INSERT_NEW_IDX_ELSE>
+ null,
+// </INSERT_NEW_IDX_ELSE>
+// <REMOVE_IDX>
+ this::removeComplexList,
+// </REMOVE_IDX>
+// <REMOVE_IDX_ELSE>
+ null,
+// </REMOVE_IDX_ELSE>
+// <SIZE_OF_ARRAY>
+ this::sizeOfComplexListArray
+// </SIZE_OF_ARRAY>
+// <SIZE_OF_ARRAY_ELSE>
+ null
+// </SIZE_OF_ARRAY_ELSE>
+ );
+ }
+ }
+// </GET_LIST>
+// <GET_ARRAY>
+
+ /**
+ * Gets array of all "complexList" elements
+ */
+ @Override
+ public partials.XmlBeanchen[] getComplexListArray() {
+ return getXmlObjectArray(PROPERTY_QNAME[3], new partials.XmlBeanchen[0]);
+ }
+// </GET_ARRAY>
+// <GET_IDX>
+
+ /**
+ * Gets ith "complexList" element
+ */
+ @Override
+ public partials.XmlBeanchen getComplexListArray(int i) {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ partials.XmlBeanchen target = null;
+ target = (partials.XmlBeanchen)get_store().find_element_user(PROPERTY_QNAME[3], i);
+ if (target == null) {
+ throw new IndexOutOfBoundsException();
+ }
+ return target;
+ }
+ }
+// </GET_IDX>
+// <SIZE_OF_ARRAY>
+
+ /**
+ * Returns number of "complexList" element
+ */
+ @Override
+ public int sizeOfComplexListArray() {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ return get_store().count_elements(PROPERTY_QNAME[3]);
+ }
+ }
+// </SIZE_OF_ARRAY>
+// <SET_ARRAY>
+
+ /**
+ * Sets array of all "complexList" element WARNING: This method is not atomicaly synchronized.
+ */
+ @Override
+ public void setComplexListArray(partials.XmlBeanchen[] complexListArray) {
+ check_orphaned();
+ arraySetterHelper(complexListArray, PROPERTY_QNAME[3]);
+ }
+// </SET_ARRAY>
+// <SET_IDX>
+
+ /**
+ * Sets ith "complexList" element
+ */
+ @Override
+ public void setComplexListArray(int i, partials.XmlBeanchen complexList) {
+ generatedSetterHelperImpl(complexList, PROPERTY_QNAME[3], i, org.apache.xmlbeans.impl.values.XmlObjectBase.KIND_SETTERHELPER_ARRAYITEM);
+ }
+// </SET_IDX>
+// <INSERT_NEW_IDX>
+
+ /**
+ * Inserts and returns a new empty value (as xml) as the ith "complexList" element
+ */
+ @Override
+ public partials.XmlBeanchen insertNewComplexList(int i) {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ partials.XmlBeanchen target = null;
+ target = (partials.XmlBeanchen)get_store().insert_element_user(PROPERTY_QNAME[3], i);
+ return target;
+ }
+ }
+// </INSERT_NEW_IDX>
+// <ADD_NEW>
+
+ /**
+ * Appends and returns a new empty value (as xml) as the last "complexList" element
+ */
+ @Override
+ public partials.XmlBeanchen addNewComplexList() {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ partials.XmlBeanchen target = null;
+ target = (partials.XmlBeanchen)get_store().add_element_user(PROPERTY_QNAME[3]);
+ return target;
+ }
+ }
+// </ADD_NEW>
+// <REMOVE_IDX>
+
+ /**
+ * Removes the ith "complexList" element
+ */
+ @Override
+ public void removeComplexList(int i) {
+ synchronized (monitor())
+ {
+ check_orphaned();
+ get_store().remove_element(PROPERTY_QNAME[3], i);
+ }
+ }
+// </REMOVE_IDX>
+ }
+}
diff --git a/src/test/resources/xbean/compile/scomp/partials/partialMethods.xsd b/src/test/resources/xbean/compile/scomp/partials/partialMethods.xsd
new file mode 100755
index 0000000..67282a7
--- /dev/null
+++ b/src/test/resources/xbean/compile/scomp/partials/partialMethods.xsd
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!-- Copyright 2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License. -->
+
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns="partials"
+ targetNamespace="partials"
+ elementFormDefault="qualified">
+
+ <xs:element name="root">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="single" minOccurs="0" type="xs:decimal" nillable="true"/>
+ <xs:element name="complex" minOccurs="0" type="xmlBeanchen"/>
+ <xs:element name="primitiveList" minOccurs="0" maxOccurs="unbounded" type="xs:decimal" nillable="true"/>
+ <xs:element name="complexList" minOccurs="0" maxOccurs="unbounded" type="xmlBeanchen"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="xmlBeanchen">
+ <xs:attribute name="name" type="xs:string"/>
+ </xs:complexType>
+</xs:schema>