You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2020/09/17 00:04:39 UTC
svn commit: r1881778 [9/10] - in /xmlbeans/trunk: ./
src/main/java/org/apache/xmlbeans/
src/main/java/org/apache/xmlbeans/impl/common/
src/main/java/org/apache/xmlbeans/impl/schema/
src/main/java/org/apache/xmlbeans/impl/store/ src/main/java/org/apache...
Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/XmlUnsignedShort.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/XmlUnsignedShort.java?rev=1881778&r1=1881777&r2=1881778&view=diff
==============================================================================
--- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/XmlUnsignedShort.java (original)
+++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/XmlUnsignedShort.java Thu Sep 17 00:04:39 2020
@@ -15,9 +15,6 @@
package org.apache.xmlbeans;
-import javax.xml.stream.XMLStreamReader;
-
-
/**
* Corresponds to the XML Schema
* <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#unsignedShort">xs:unsignedShort</a> type.
@@ -26,24 +23,33 @@ import javax.xml.stream.XMLStreamReader;
* Verified to be in the range 0..65535 when validating.
* <p>
* Convertible to a Java int.
- */
-public interface XmlUnsignedShort extends XmlUnsignedInt
-{
- /** The constant {@link SchemaType} object representing this schema type. */
- public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_unsignedShort");
-
- /** Returns this value as an int */
+ */
+public interface XmlUnsignedShort extends XmlUnsignedInt {
+ /**
+ * The constant {@link SchemaType} object representing this schema type.
+ */
+ SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_unsignedShort");
+
+ /**
+ * Returns this value as an int
+ */
int getIntValue();
- /** Sets this value as an int */
+
+ /**
+ * Sets this value as an int
+ */
void setIntValue(int v);
/**
* Returns this value as an int
+ *
* @deprecated replaced with {@link #getIntValue}
**/
int intValue();
+
/**
* Sets this value as an int
+ *
* @deprecated replaced with {@link #setIntValue}
**/
void set(int v);
@@ -52,101 +58,129 @@ public interface XmlUnsignedShort extend
* A class with methods for creating instances
* of {@link XmlUnsignedShort}.
*/
- public static final class Factory
- {
- /** Creates an empty instance 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} */
+ 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 */
+ 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>". */
+ 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>". */
+ 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. */
+ 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. */
+ 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. */
+ 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 ); }
+ return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse(u, type, null);
+ }
- /** Parses a {@link XmlUnsignedShort} fragment from a URL. */
+ /**
+ * 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 ); }
+ return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse(u, type, options);
+ }
- /** Parses a {@link XmlUnsignedShort} fragment from an InputStream. */
+ /**
+ * 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. */
+ 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. */
+ 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. */
+ 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. */
+ 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. */
+ 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 XMLInputStream.
- * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
- */
- public static XmlUnsignedShort parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
- return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
-
- /** Parses a {@link XmlUnsignedShort} fragment from an XMLInputStream.
- * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
- */
- public static XmlUnsignedShort parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
- return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
-
- /** Parses a {@link XmlUnsignedShort} fragment from an XMLStreamReader. */
+ 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 ); }
-
- /** Returns a validating XMLInputStream.
- * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
- */
- public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
- return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
-
- /** Returns a validating XMLInputStream.
- * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
- */
- public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
- return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
-
- private Factory() { } // No instance of this class allowed
+ 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
+ }
}
}
Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java?rev=1881778&r1=1881777&r2=1881778&view=diff
==============================================================================
--- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java (original)
+++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java Thu Sep 17 00:04:39 2020
@@ -32,7 +32,6 @@ import java.util.*;
public final class SchemaTypeCodePrinter implements SchemaCodePrinter {
Writer _writer;
int _indent;
- boolean _useJava15;
static final String LINE_SEPARATOR =
@@ -59,19 +58,11 @@ public final class SchemaTypeCodePrinter
private static SchemaCodePrinter getPrinter(XmlOptions opt) {
SchemaCodePrinter printer = opt == null ? null : opt.getSchemaCodePrinter();
- return printer == null ? new SchemaTypeCodePrinter(opt) : printer;
+ return printer == null ? new SchemaTypeCodePrinter() : printer;
}
- public SchemaTypeCodePrinter(XmlOptions opt) {
+ public SchemaTypeCodePrinter() {
_indent = 0;
-
- String genversion = (opt == null) ? null : opt.getGenerateJavaVersion();
-
- if (genversion == null) {
- genversion = XmlOptions.GENERATE_JAVA_14;
- }
-
- _useJava15 = XmlOptions.GENERATE_JAVA_15.equals(genversion);
}
void indent() {
@@ -173,6 +164,9 @@ public final class SchemaTypeCodePrinter
}
static String prettyQName(QName qname) {
+ if (qname == null) {
+ return "";
+ }
String result = qname.getLocalPart();
if (qname.getNamespaceURI() != null) {
result += "(@" + qname.getNamespaceURI() + ")";
@@ -229,7 +223,7 @@ public final class SchemaTypeCodePrinter
SchemaTypeImpl sTypeI = (SchemaTypeImpl) sType;
String ret = sTypeI.getFullJavaName();
- while (sTypeI.isRedefinition()) {
+ while (sTypeI != null && sTypeI.isRedefinition()) {
ret = sTypeI.getFullJavaName();
sTypeI = (SchemaTypeImpl) sTypeI.getBaseType();
}
@@ -258,7 +252,7 @@ public final class SchemaTypeCodePrinter
}
void printStaticTypeDeclaration(SchemaType sType, SchemaTypeSystem system) throws IOException {
- emit("public static final org.apache.xmlbeans.SchemaType type = (org.apache.xmlbeans.SchemaType)");
+ emit("org.apache.xmlbeans.SchemaType type = (org.apache.xmlbeans.SchemaType)");
indent();
emit("Factory.getTypeLoader().resolveHandle(\"" + ((SchemaTypeSystemImpl) system).handleForType(sType) + "\");");
outdent();
@@ -340,7 +334,7 @@ public final class SchemaTypeCodePrinter
emit("");
// BUGBUG - Can I use the name loader here? could it be a
// nested type name? It is lower case!
- emit("public static final class Factory");
+ emit("final class Factory");
emit("{");
indent();
@@ -356,26 +350,15 @@ public final class SchemaTypeCodePrinter
}
// Only need newInstance() for non-abstract types
- if (sType.isAbstract()) {
- emit("/** @deprecated No need to be able to create instances of abstract types */");
- if (_useJava15) {
- emit("@Deprecated");
- }
- }
- emit("public static " + fullName + " newInstance() {");
- emit(" return (" + fullName + ") getTypeLoader().newInstance( type, null ); }");
- emit("");
+ if (!sType.isAbstract()) {
+ emit("public static " + fullName + " newInstance() {");
+ emit(" return (" + fullName + ") getTypeLoader().newInstance( type, null ); }");
+ emit("");
- // Only need newInstance() for non-abstract types
- if (sType.isAbstract()) {
- emit("/** @deprecated No need to be able to create instances of abstract types */");
- if (_useJava15) {
- emit("@Deprecated");
- }
+ emit("public static " + fullName + " newInstance(org.apache.xmlbeans.XmlOptions options) {");
+ emit(" return (" + fullName + ") getTypeLoader().newInstance( type, options ); }");
+ 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 */");
@@ -435,40 +418,6 @@ public final class SchemaTypeCodePrinter
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("/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */");
- if (_useJava15) {
- emit("@Deprecated");
- }
- emit("public static " + fullName + " parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {");
- emit(" return (" + fullName + ") getTypeLoader().parse( xis, type, null ); }");
- emit("");
-
- emit("/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */");
- if (_useJava15) {
- emit("@Deprecated");
- }
- emit("public static " + fullName + " parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {");
- emit(" return (" + fullName + ") getTypeLoader().parse( xis, type, options ); }");
- emit("");
-
- // Don't have XMLInputStream anymore
- emit("/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */");
- if (_useJava15) {
- emit("@Deprecated");
- }
- emit("public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {");
- emit(" return getTypeLoader().newValidatingXMLInputStream( xis, type, null ); }");
- emit("");
-
- // Don't have XMLInputStream anymore
- emit("/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */");
- if (_useJava15) {
- emit("@Deprecated");
- }
- emit("public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {");
- emit(" return getTypeLoader().newValidatingXMLInputStream( xis, type, options ); }");
- emit("");
}
emit("private Factory() { } // No instance of this class allowed");
@@ -591,7 +540,7 @@ public final class SchemaTypeCodePrinter
InterfaceExtension[] exts = sImpl.getInterfaceExtensions();
if (exts != null) {
for (InterfaceExtension ext : exts) {
- sb.append(", " + ext.getInterface());
+ sb.append(", ").append(ext.getInterface());
}
}
@@ -615,68 +564,18 @@ public final class SchemaTypeCodePrinter
if (bits == SchemaType.SIZE_BIG_INTEGER) {
emit("java.math.BigInteger getBigIntegerValue();");
emit("void setBigIntegerValue(java.math.BigInteger bi);");
- emit("/** @deprecated */");
- if (_useJava15) {
- emit("@Deprecated");
- }
- emit("java.math.BigInteger bigIntegerValue();");
- emit("/** @deprecated */");
- if (_useJava15) {
- emit("@Deprecated");
- }
- emit("void set(java.math.BigInteger bi);");
} else if (bits == SchemaType.SIZE_LONG) {
emit("long getLongValue();");
emit("void setLongValue(long l);");
- emit("/** @deprecated */");
- if (_useJava15) {
- emit("@Deprecated");
- }
- emit("long longValue();");
- emit("/** @deprecated */");
- if (_useJava15) {
- emit("@Deprecated");
- }
- emit("void set(long l);");
} else if (bits == SchemaType.SIZE_INT) {
emit("int getIntValue();");
emit("void setIntValue(int i);");
- emit("/** @deprecated */");
- if (_useJava15) {
- emit("@Deprecated");
- }
- emit("int intValue();");
- emit("/** @deprecated */");
- if (_useJava15) {
- emit("@Deprecated");
- }
- emit("void set(int i);");
} else if (bits == SchemaType.SIZE_SHORT) {
emit("short getShortValue();");
emit("void setShortValue(short s);");
- emit("/** @deprecated */");
- if (_useJava15) {
- emit("@Deprecated");
- }
- emit("short shortValue();");
- emit("/** @deprecated */");
- if (_useJava15) {
- emit("@Deprecated");
- }
- emit("void set(short s);");
} else if (bits == SchemaType.SIZE_BYTE) {
emit("byte getByteValue();");
emit("void setByteValue(byte b);");
- emit("/** @deprecated */");
- if (_useJava15) {
- emit("@Deprecated");
- }
- emit("byte byteValue();");
- emit("/** @deprecated */");
- if (_useJava15) {
- emit("@Deprecated");
- }
- emit("void set(byte b);");
}
}
}
@@ -684,16 +583,6 @@ public final class SchemaTypeCodePrinter
if (sType.getSimpleVariety() == SchemaType.UNION) {
emit("java.lang.Object getObjectValue();");
emit("void setObjectValue(java.lang.Object val);");
- emit("/** @deprecated */");
- if (_useJava15) {
- emit("@Deprecated");
- }
- emit("java.lang.Object objectValue();");
- emit("/** @deprecated */");
- if (_useJava15) {
- emit("@Deprecated");
- }
- emit("void objectSet(java.lang.Object val);");
emit("org.apache.xmlbeans.SchemaType instanceType();");
SchemaType ctype = sType.getUnionCommonBaseType();
if (ctype != null && ctype.getSimpleVariety() != SchemaType.UNION) {
@@ -705,25 +594,10 @@ public final class SchemaTypeCodePrinter
emit("java.util.List getListValue();");
emit("java.util.List xgetListValue();");
emit("void setListValue(java.util.List list);");
- emit("/** @deprecated */");
- if (_useJava15) {
- emit("@Deprecated");
- }
- emit("java.util.List listValue();");
- emit("/** @deprecated */");
- if (_useJava15) {
- emit("@Deprecated");
- }
- emit("java.util.List xlistValue();");
- emit("/** @deprecated */");
- if (_useJava15) {
- emit("@Deprecated");
- }
- emit("void set(java.util.List list);");
}
}
- void startBlock() throws IOException {
+ void startBlock() {
// emit("{");
indent();
}
@@ -1043,16 +917,14 @@ public final class SchemaTypeCodePrinter
if (several) {
String arrayName = propertyName + "Array";
- if (_useJava15) {
- String wrappedType = type;
- if (isJavaPrimitive(javaType)) {
- wrappedType = javaWrappedType(javaType);
- }
-
- printJavaDoc("Gets a List of " + propdesc + "s");
- emit("java.util.List<" + wrappedType + "> get" + propertyName + "List();");
+ String wrappedType = type;
+ if (isJavaPrimitive(javaType)) {
+ wrappedType = javaWrappedType(javaType);
}
+ printJavaDoc("Gets a List of " + propdesc + "s");
+ emit("java.util.List<" + wrappedType + "> get" + propertyName + "List();");
+
printJavaDoc("Gets array of all " + propdesc + "s");
emit(type + "[] get" + arrayName + "();");
@@ -1060,10 +932,8 @@ public final class SchemaTypeCodePrinter
emit(type + " get" + arrayName + "(int i);");
if (!xmltype) {
- if (_useJava15) {
- 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");
+ emit("java.util.List<" + xtype + "> xget" + propertyName + "List();");
printJavaDoc("Gets (as xml) array of all " + propdesc + "s");
emit(xtype + "[] xget" + arrayName + "();");
@@ -1284,7 +1154,7 @@ public final class SchemaTypeCodePrinter
if (sType.getSimpleVariety() == SchemaType.UNION) {
SchemaType[] memberTypes = sType.getUnionMemberTypes();
for (SchemaType memberType : memberTypes) {
- interfaces.append(", " + memberType.getFullJavaName().replace('$', '.'));
+ interfaces.append(", ").append(memberType.getFullJavaName().replace('$', '.'));
}
}
@@ -1689,14 +1559,7 @@ public final class SchemaTypeCodePrinter
emit("}");
}
- void emitDeclareTarget(boolean declareTarget, String xtype)
- throws IOException {
- if (declareTarget) {
- emit(xtype + " target = null;");
- }
- }
-
- void emitAddTarget(String identifier, boolean isAttr, boolean declareTarget, String xtype)
+ void emitAddTarget(String identifier, boolean isAttr, String xtype)
throws IOException {
if (isAttr) {
emit("target = (" + xtype + ")get_store().add_attribute_user(" + identifier + ");");
@@ -1794,7 +1657,7 @@ public final class SchemaTypeCodePrinter
switch (nullBehaviour) {
case ADD_NEW_VALUE:
// target already emited, no need for emitDeclareTarget(false, xtype);
- emitAddTarget(identifier, isAttr, false, xtype);
+ emitAddTarget(identifier, isAttr, xtype);
break;
case THROW_EXCEPTION:
@@ -1813,7 +1676,7 @@ public final class SchemaTypeCodePrinter
void printListGetter15Impl(String parentJavaName,
String propdesc, String propertyName,
- String wrappedType, String xtype,
+ String wrappedType,
boolean xmltype, boolean xget)
throws IOException {
String arrayName = propertyName + "Array";
@@ -1832,17 +1695,13 @@ public final class SchemaTypeCodePrinter
startBlock();
// Object get(i)
- if (_useJava15) {
- emit("@Override");
- }
+ emit("@Override");
emit("public " + wrappedType + " get(int i)");
emit(" { return " + parentThis + xgetMethod + arrayName + "(i); }");
emit("");
// Object set(i, o)
- if (_useJava15) {
- emit("@Override");
- }
+ emit("@Override");
emit("public " + wrappedType + " set(int i, " + wrappedType + " o) {");
startBlock();
emit(wrappedType + " old = " + parentThis + xgetMethod + arrayName + "(i);");
@@ -1852,9 +1711,7 @@ public final class SchemaTypeCodePrinter
emit("");
// void add(i, o)
- if (_useJava15) {
- emit("@Override");
- }
+ emit("@Override");
emit("public void add(int i, " + wrappedType + " o)");
if (xmltype || xget) {
emit(" { " + parentThis + "insertNew" + propertyName + "(i).set(o); }");
@@ -1864,9 +1721,7 @@ public final class SchemaTypeCodePrinter
emit("");
// Object remove(i)
- if (_useJava15) {
- emit("@Override");
- }
+ emit("@Override");
emit("public " + wrappedType + " remove(int i) {");
startBlock();
emit(wrappedType + " old = " + parentThis + xgetMethod + arrayName + "(i);");
@@ -1876,9 +1731,7 @@ public final class SchemaTypeCodePrinter
emit("");
// int size()
- if (_useJava15) {
- emit("@Override");
- }
+ emit("@Override");
emit("public int size()");
emit(" { return " + parentThis + "sizeOf" + arrayName + "(); }");
emit("");
@@ -1992,17 +1845,15 @@ public final class SchemaTypeCodePrinter
if (several) {
String arrayName = propertyName + "Array";
- if (_useJava15) {
- // use boxed type if the java type is a primitive and jdk1.5
- // jdk1.5 will box/unbox for us
- String wrappedType = type;
- if (isJavaPrimitive(javaType)) {
- wrappedType = javaWrappedType(javaType);
- }
-
- printListGetter15Impl(parentJavaName, propdesc, propertyName, wrappedType, xtype, xmltype, false);
+ // use boxed type if the java type is a primitive and jdk1.5
+ // jdk1.5 will box/unbox for us
+ String wrappedType = type;
+ if (isJavaPrimitive(javaType)) {
+ wrappedType = javaWrappedType(javaType);
}
+ printListGetter15Impl(parentJavaName, propdesc, propertyName, wrappedType, xmltype, false);
+
// Value[] getProp()
printJavaDoc("Gets array of all " + propdesc + "s");
emit("public " + type + "[] get" + arrayName + "() {");
@@ -2025,9 +1876,7 @@ public final class SchemaTypeCodePrinter
endBlock();
if (!xmltype) {
- if (_useJava15) {
- printListGetter15Impl(parentJavaName, propdesc, propertyName, xtype, xtype, xmltype, true);
- }
+ printListGetter15Impl(parentJavaName, propdesc, propertyName, xtype, false, true);
// Value[] xgetProp()
printJavaDoc("Gets (as xml) array of all " + propdesc + "s");
@@ -2081,7 +1930,7 @@ public final class SchemaTypeCodePrinter
boolean xmltype = (javaType == SchemaProperty.XML_OBJECT);
boolean isobj = (javaType == SchemaProperty.JAVA_OBJECT);
- boolean isSubstGroup = identifier != setIdentifier;
+ boolean isSubstGroup = !Objects.equals(identifier, setIdentifier);
String jtargetType = (isunion || !xmltype) ? "org.apache.xmlbeans.SimpleValue" : xtype;
String propdesc = "\"" + qName.getLocalPart() + "\"" + (isAttr ? " attribute" : " element");
@@ -2092,10 +1941,10 @@ public final class SchemaTypeCodePrinter
emit("public void set" + propertyName + "(" + type + " " + safeVarName + ") {");
startBlock();
if (xmltype && !isSubstGroup && !isAttr) {
- emitPre(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, several ? "0" : "-1");
+ 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, isAttr, several ? "0" : "-1");
+ emitPost(sType, PrePostExtension.OPERATION_SET, identifier, false, several ? "0" : "-1");
} else {
emitImplementationPreamble();
emitPre(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, several ? "0" : "-1");
@@ -2127,9 +1976,9 @@ public final class SchemaTypeCodePrinter
emit("public " + xtype + " addNew" + propertyName + "() {");
startBlock();
emitImplementationPreamble();
- emitDeclareTarget(true, xtype);
+ emit(xtype + " target = null;");
emitPre(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr);
- emitAddTarget(identifier, isAttr, true, xtype);
+ emitAddTarget(identifier, isAttr, xtype);
emitPost(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr);
emit("return target;");
emitImplementationPostamble();
@@ -2314,9 +2163,9 @@ public final class SchemaTypeCodePrinter
emit("public void add" + propertyName + "(" + type + " " + safeVarName + ") {");
startBlock();
emitImplementationPreamble();
- emitDeclareTarget(true, jtargetType);
+ emit(jtargetType + " target = null;");
emitPre(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr);
- emitAddTarget(identifier, isAttr, true, jtargetType);
+ emitAddTarget(identifier, isAttr, jtargetType);
printJSetValue(javaType, safeVarName, (SchemaTypeImpl) prop.getType());
emitPost(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr);
emitImplementationPostamble();
@@ -2327,7 +2176,7 @@ public final class SchemaTypeCodePrinter
emit("public " + xtype + " insertNew" + propertyName + "(int i) {");
startBlock();
emitImplementationPreamble();
- emitDeclareTarget(true, xtype);
+ emit(xtype + " target = null;");
emitPre(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr, "i");
if (!isSubstGroup) {
emit("target = (" + xtype + ")get_store().insert_element_user(" + identifier + ", i);");
@@ -2345,9 +2194,9 @@ public final class SchemaTypeCodePrinter
emit("public " + xtype + " addNew" + propertyName + "() {");
startBlock();
emitImplementationPreamble();
- emitDeclareTarget(true, xtype);
+ emit(xtype + " target = null;");
emitPre(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr);
- emitAddTarget(identifier, isAttr, true, xtype);
+ emitAddTarget(identifier, isAttr, xtype);
emitPost(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr);
emit("return target;");
emitImplementationPostamble();
@@ -2537,7 +2386,7 @@ public final class SchemaTypeCodePrinter
String[] exceptions = method.getExceptionTypes();
for (int i = 0; i < exceptions.length; i++) {
- decl.append((i == 0 ? " throws " : ", ") + exceptions[i]);
+ decl.append(i == 0 ? " throws " : ", ").append(exceptions[i]);
}
decl.append(" {");
@@ -2556,7 +2405,7 @@ public final class SchemaTypeCodePrinter
String[] params = method.getParameterTypes();
for (int i = 0; i < params.length; i++) {
- impl.append(", p" + i);
+ impl.append(", p").append(i);
}
impl.append(");");
Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/SchemaTypeLoaderBase.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/SchemaTypeLoaderBase.java?rev=1881778&r1=1881777&r2=1881778&view=diff
==============================================================================
--- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/SchemaTypeLoaderBase.java (original)
+++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/SchemaTypeLoaderBase.java Thu Sep 17 00:04:39 2020
@@ -18,10 +18,7 @@ package org.apache.xmlbeans.impl.schema;
import org.apache.xmlbeans.*;
import org.apache.xmlbeans.impl.common.QNameHelper;
import org.apache.xmlbeans.impl.store.Locale;
-import org.apache.xmlbeans.impl.validator.ValidatingXMLInputStream;
import org.apache.xmlbeans.impl.xpath.XPathFactory;
-import org.apache.xmlbeans.xml.stream.XMLInputStream;
-import org.apache.xmlbeans.xml.stream.XMLStreamException;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Node;
@@ -142,19 +139,6 @@ public abstract class SchemaTypeLoaderBa
return Locale.parseToXmlObject(this, xmlText, type, options);
}
- /**
- * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
- */
- public XmlObject parse(XMLInputStream xis, SchemaType type, XmlOptions options) throws XmlException, XMLStreamException {
- XmlFactoryHook hook = XmlFactoryHook.ThreadContext.getHook();
-
- if (hook != null) {
- return hook.parse(this, xis, type, options);
- }
-
- return Locale.parseToXmlObject(this, xis, type, options);
- }
-
public XmlObject parse(XMLStreamReader xsr, SchemaType type, XmlOptions options) throws XmlException {
XmlFactoryHook hook = XmlFactoryHook.ThreadContext.getHook();
@@ -289,13 +273,6 @@ public abstract class SchemaTypeLoaderBa
return Locale.newDomImplementation(this, options);
}
- /**
- * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
- */
- public XMLInputStream newValidatingXMLInputStream(XMLInputStream xis, SchemaType type, XmlOptions options) throws XmlException, XMLStreamException {
- return new ValidatingXMLInputStream(xis, this, type, options);
- }
-
//
//
//
Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/store/Cursor.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/store/Cursor.java?rev=1881778&r1=1881777&r2=1881778&view=diff
==============================================================================
--- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/store/Cursor.java (original)
+++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/store/Cursor.java Thu Sep 17 00:04:39 2020
@@ -25,7 +25,6 @@ import org.apache.xmlbeans.impl.store.Lo
import org.apache.xmlbeans.impl.store.Saver.TextSaver;
import org.apache.xmlbeans.impl.xpath.XPathEngine;
import org.apache.xmlbeans.impl.xpath.XPathFactory;
-import org.apache.xmlbeans.xml.stream.XMLInputStream;
import org.w3c.dom.Node;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
@@ -481,12 +480,6 @@ public final class Cursor implements Xml
// These simply delegate to the version of the method which takes XmlOptions
//
- /**
- * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
- */
- public XMLInputStream _newXMLInputStream() {
- return _newXMLInputStream(null);
- }
public XMLStreamReader _newXMLStreamReader() {
return _newXMLStreamReader(null);
@@ -536,13 +529,6 @@ public final class Cursor implements Xml
return Jsr173.newXmlStreamReader(_cur, options);
}
- /**
- * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
- */
- public XMLInputStream _newXMLInputStream(XmlOptions options) {
- return new Saver.XmlInputStreamImpl(_cur, options);
- }
-
public String _xmlText(XmlOptions options) {
assert isValid();
@@ -1948,13 +1934,6 @@ public final class Cursor implements Xml
return syncWrap(() -> _newXMLStreamReader(options));
}
- /**
- * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
- */
- public XMLInputStream newXMLInputStream() {
- return syncWrap((Supplier<XMLInputStream>) this::_newXMLInputStream);
- }
-
public String xmlText() {
return syncWrap((Supplier<String>) this::_xmlText);
}
@@ -1991,13 +1970,6 @@ public final class Cursor implements Xml
syncWrapIOEx(() -> _save(w));
}
- /**
- * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
- */
- public XMLInputStream newXMLInputStream(XmlOptions options) {
- return syncWrap(() -> _newXMLInputStream(options));
- }
-
public String xmlText(XmlOptions options) {
return syncWrap(() -> _xmlText(options));
}
Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/store/Locale.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/store/Locale.java?rev=1881778&r1=1881777&r2=1881778&view=diff
==============================================================================
--- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/store/Locale.java (original)
+++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/store/Locale.java Thu Sep 17 00:04:39 2020
@@ -22,9 +22,7 @@ import org.apache.xmlbeans.impl.store.Cu
import org.apache.xmlbeans.impl.store.DomImpl.Dom;
import org.apache.xmlbeans.impl.store.Saaj.SaajCallback;
import org.apache.xmlbeans.impl.values.TypeStore;
-import org.apache.xmlbeans.xml.stream.CharacterData;
-import org.apache.xmlbeans.xml.stream.ProcessingInstruction;
-import org.apache.xmlbeans.xml.stream.*;
+import org.apache.xmlbeans.xml.stream.XMLEvent;
import org.w3c.dom.*;
import org.xml.sax.*;
import org.xml.sax.ext.DeclHandler;
@@ -593,55 +591,6 @@ public final class Locale
//
//
- /**
- * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
- */
- public static XmlObject parseToXmlObject(SchemaTypeLoader stl,
- XMLInputStream xis, SchemaType type, XmlOptions options)
- throws XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
- Locale l = getLocale(stl, options);
-
- if (l.noSync()) {
- l.enter();
- try {
- return l.parseToXmlObject(xis, type, options);
- } finally {
- l.exit();
- }
- } else {
- synchronized (l) {
- l.enter();
- try {
- return l.parseToXmlObject(xis, type, options);
- } finally {
- l.exit();
- }
- }
- }
- }
-
- /**
- * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
- */
- public XmlObject parseToXmlObject(XMLInputStream xis, SchemaType type,
- XmlOptions options)
- throws XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
- Cur c;
-
- try {
- c = loadXMLInputStream(xis, options);
- } catch (org.apache.xmlbeans.xml.stream.XMLStreamException e) {
- throw new XmlException(e.getMessage(), e);
- }
-
- autoTypeDocument(c, type, options);
-
- XmlObject x = (XmlObject) c.getUser();
-
- c.release();
-
- return x;
- }
//
//
@@ -736,181 +685,6 @@ public final class Locale
}
- /**
- * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
- */
- private Cur loadXMLInputStream(XMLInputStream xis, XmlOptions options)
- throws org.apache.xmlbeans.xml.stream.XMLStreamException {
- options = XmlOptions.maskNull(options);
-
- boolean lineNums = options.isLoadLineNumbers();
-
- XMLEvent x = xis.peek();
-
- if (x != null && x.getType() == XMLEvent.START_ELEMENT) {
- Map<String, String> nsMap = ((StartElement) x).getNamespaceMap();
-
- if (nsMap != null && nsMap.size() > 0) {
-
- Map<String, String> namespaces = new HashMap<>(nsMap);
-
- options = new XmlOptions(options);
-
- options.setLoadAdditionalNamespaces(namespaces);
- }
- }
-
- String systemId = null;
- String encoding = null;
- String version = null;
- boolean standAlone = true;
-
- LoadContext context = new Cur.CurLoadContext(this, options);
-
- events:
- for (XMLEvent xe = xis.next(); xe != null; xe = xis.next()) {
- switch (xe.getType()) {
- case XMLEvent.START_DOCUMENT:
- StartDocument doc = (StartDocument) xe;
-
- systemId = doc.getSystemId();
- encoding = doc.getCharacterEncodingScheme();
- version = doc.getVersion();
- standAlone = doc.isStandalone();
- standAlone = doc.isStandalone();
-
- if (lineNums) {
- lineNumber(xe, context);
- }
-
- break;
-
- case XMLEvent.END_DOCUMENT:
- if (lineNums) {
- lineNumber(xe, context);
- }
-
- break events;
-
- case XMLEvent.NULL_ELEMENT:
- if (!xis.hasNext()) {
- break events;
- }
- break;
-
- case XMLEvent.START_ELEMENT:
- context.startElement(XMLNameHelper.getQName(xe.getName()));
-
- if (lineNums) {
- lineNumber(xe, context);
- }
-
- for (AttributeIterator ai = ((StartElement) xe).getAttributes();
- ai.hasNext(); ) {
- Attribute attr = ai.next();
-
- context.attr(XMLNameHelper.getQName(attr.getName()),
- attr.getValue());
- }
-
- for (AttributeIterator ai = ((StartElement) xe).getNamespaces()
- ; ai.hasNext(); ) {
- Attribute attr = ai.next();
-
- XMLName name = attr.getName();
- String local = name.getLocalName();
-
- if (name.getPrefix() == null && local.equals("xmlns")) {
- local = "";
- }
-
- context.xmlns(local, attr.getValue());
- }
-
- break;
-
- case XMLEvent.END_ELEMENT:
- context.endElement();
-
- if (lineNums) {
- lineNumber(xe, context);
- }
-
- break;
-
- case XMLEvent.SPACE:
- if (((Space) xe).ignorable()) {
- break;
- }
-
- // Fall through
-
- case XMLEvent.CHARACTER_DATA:
- CharacterData cd = (CharacterData) xe;
-
- if (cd.hasContent()) {
- context.text(cd.getContent());
-
- if (lineNums) {
- lineNumber(xe, context);
- }
- }
-
- break;
-
- case XMLEvent.COMMENT:
- org.apache.xmlbeans.xml.stream.Comment comment =
- (org.apache.xmlbeans.xml.stream.Comment) xe;
-
- if (comment.hasContent()) {
- context.comment(comment.getContent());
-
- if (lineNums) {
- lineNumber(xe, context);
- }
- }
-
- break;
-
- case XMLEvent.PROCESSING_INSTRUCTION:
- ProcessingInstruction procInstr = (ProcessingInstruction) xe;
-
- context.procInst(procInstr.getTarget(), procInstr.getData());
-
- if (lineNums) {
- lineNumber(xe, context);
- }
-
- break;
-
- // These are ignored
- case XMLEvent.ENTITY_REFERENCE:
- case XMLEvent.START_PREFIX_MAPPING:
- case XMLEvent.END_PREFIX_MAPPING:
- case XMLEvent.CHANGE_PREFIX_MAPPING:
- case XMLEvent.XML_EVENT:
- break;
-
- default:
- throw new RuntimeException(
- "Unhandled xml event type: " + xe.getTypeAsString());
- }
- }
-
- Cur c = context.finish();
-
- associateSourceName(c, options);
-
- XmlDocumentProperties props = getDocProps(c, true);
-
- props.setDoctypeSystemId(systemId);
- props.setEncoding(encoding);
- props.setVersion(version);
- props.setStandalone(standAlone);
-
- return c;
- }
-
private Cur loadXMLStreamReader(XMLStreamReader xsr, XmlOptions options)
throws XMLStreamException {
options = XmlOptions.maskNull(options);
Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/store/Saver.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/store/Saver.java?rev=1881778&r1=1881777&r2=1881778&view=diff
==============================================================================
--- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/store/Saver.java (original)
+++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/store/Saver.java Thu Sep 17 00:04:39 2020
@@ -19,7 +19,10 @@ import org.apache.xmlbeans.SystemPropert
import org.apache.xmlbeans.XmlDocumentProperties;
import org.apache.xmlbeans.XmlOptionCharEscapeMap;
import org.apache.xmlbeans.XmlOptions;
-import org.apache.xmlbeans.impl.common.*;
+import org.apache.xmlbeans.impl.common.EncodingMap;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+import org.apache.xmlbeans.impl.common.XmlEventBase;
+import org.apache.xmlbeans.impl.common.XmlNameImpl;
import org.apache.xmlbeans.xml.stream.CharacterData;
import org.apache.xmlbeans.xml.stream.*;
import org.xml.sax.ContentHandler;
@@ -118,7 +121,8 @@ abstract class Saver {
SynthNamespaceSaver saver = new SynthNamespaceSaver(c, options);
//noinspection StatementWithEmptyBody
- while (saver.process()) { }
+ while (saver.process()) {
+ }
if (!saver._synthNamespaces.isEmpty()) {
_preComputedNamespaces = saver._synthNamespaces;
@@ -356,7 +360,8 @@ abstract class Saver {
if (docTypeName == null) {
_cur.push();
//noinspection StatementWithEmptyBody
- while (!_cur.isElem() && _cur.next()) { }
+ while (!_cur.isElem() && _cur.next()) {
+ }
if (_cur.isElem()) {
docTypeName = _cur.getName().getLocalPart();
}
@@ -453,7 +458,7 @@ abstract class Saver {
// namespaces are mapped on the first container which has a name.
if (_preComputedNamespaces != null) {
- for (Map.Entry<String,String> entry : _preComputedNamespaces.entrySet()) {
+ for (Map.Entry<String, String> entry : _preComputedNamespaces.entrySet()) {
String uri = entry.getKey();
String prefix = entry.getValue();
boolean considerDefault = prefix.length() == 0 && !ensureDefaultEmpty;
@@ -792,7 +797,7 @@ abstract class Saver {
return _prefixMap.get(prefix);
}
- protected Map<String,String> getPrefixMap() {
+ protected Map<String, String> getPrefixMap() {
return _prefixMap;
}
@@ -801,7 +806,7 @@ abstract class Saver {
//
static final class SynthNamespaceSaver extends Saver {
- LinkedHashMap<String,String> _synthNamespaces = new LinkedHashMap<>();
+ LinkedHashMap<String, String> _synthNamespaces = new LinkedHashMap<>();
SynthNamespaceSaver(Cur c, XmlOptions options) {
super(c, options);
@@ -1730,7 +1735,8 @@ abstract class Saver {
// create a String!
//noinspection StatementWithEmptyBody
- while (process()) { }
+ while (process()) {
+ }
assert _out == 0;
@@ -1788,7 +1794,8 @@ abstract class Saver {
try {
Saver saver = new OptimizedForSpeedSaver(cur, writer);
//noinspection StatementWithEmptyBody
- while (saver.process()) { }
+ while (saver.process()) {
+ }
} catch (SaverIOException e) {
throw (IOException) e.getCause();
}
@@ -2816,7 +2823,7 @@ abstract class Saver {
private static class StartElementImpl
extends XmlEventImpl implements StartElement {
- StartElementImpl(XMLName name, AttributeImpl attributes, AttributeImpl namespaces, Map<String,String> prefixMap) {
+ StartElementImpl(XMLName name, AttributeImpl attributes, AttributeImpl namespaces, Map<String, String> prefixMap) {
super(XMLEvent.START_ELEMENT);
_name = name;
@@ -2859,7 +2866,7 @@ abstract class Saver {
return _prefixMap.get(prefix == null ? "" : prefix);
}
- public Map<String,String> getNamespaceMap() {
+ public Map<String, String> getNamespaceMap() {
return _prefixMap;
}
@@ -3002,7 +3009,7 @@ abstract class Saver {
}
private final XMLName _name;
- private final Map<String,String> _prefixMap;
+ private final Map<String, String> _prefixMap;
private final AttributeImpl _attributes;
private final AttributeImpl _namespaces;
@@ -3153,24 +3160,6 @@ abstract class Saver {
private XmlEventImpl _in, _out;
}
- static final class XmlInputStreamImpl extends GenericXmlInputStream {
- XmlInputStreamImpl(Cur cur, XmlOptions options) {
- _xmlInputStreamSaver =
- new XmlInputStreamSaver(cur, options);
-
- // Make the saver grind away just a bit to throw any exceptions
- // related to the inability to create a stream on this xml
-
- _xmlInputStreamSaver.process();
- }
-
- protected XMLEvent nextEvent() {
- return _xmlInputStreamSaver.dequeue();
- }
-
- private final XmlInputStreamSaver _xmlInputStreamSaver;
- }
-
static final class SaxSaver extends Saver {
SaxSaver(Cur c, XmlOptions options, ContentHandler ch, LexicalHandler lh)
throws SAXException {
@@ -3186,7 +3175,8 @@ abstract class Saver {
try {
//noinspection StatementWithEmptyBody
- while (process()) { }
+ while (process()) {
+ }
} catch (SaverSAXException e) {
throw e._saxException;
}
Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/SchemaCompiler.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/SchemaCompiler.java?rev=1881778&r1=1881777&r2=1881778&view=diff
==============================================================================
--- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/SchemaCompiler.java (original)
+++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/SchemaCompiler.java Thu Sep 17 00:04:39 2020
@@ -52,7 +52,6 @@ public class SchemaCompiler {
System.out.println(" -novdoc - do not validate contents of <documentation>");
System.out.println(" -noext - ignore all extension (Pre/Post and Interface) found in .xsdconfig files");
System.out.println(" -compiler - path to external java compiler");
- System.out.println(" -javasource [version] - generate java source compatible for a Java version (1.4 or 1.5)");
System.out.println(" -ms - initial memory for external java compiler (default '" + CodeGenUtil.DEFAULT_MEM_START + "')");
System.out.println(" -mx - maximum memory for external java compiler (default '" + CodeGenUtil.DEFAULT_MEM_MAX + "')");
System.out.println(" -debug - compile with debug symbols");
@@ -102,7 +101,6 @@ public class SchemaCompiler {
opts.add("d");
opts.add("cp");
opts.add("compiler");
- opts.add("javasource");
opts.add("jar"); // deprecated
opts.add("ms");
opts.add("mx");
@@ -273,7 +271,6 @@ public class SchemaCompiler {
classpath = CodeGenUtil.systemClasspath();
}
- String javasource = cl.getOpt("javasource");
String compiler = cl.getOpt("compiler");
String jar = cl.getOpt("jar");
if (verbose && jar != null) {
@@ -313,7 +310,6 @@ public class SchemaCompiler {
params.setSrcDir(src);
params.setClassesDir(classes);
params.setCompiler(compiler);
- params.setJavaSource(javasource);
params.setMemoryInitialSize(memoryInitialSize);
params.setMemoryMaximumSize(memoryMaximumSize);
params.setNojavac(nojavac);
@@ -361,7 +357,6 @@ public class SchemaCompiler {
private String memoryInitialSize;
private String memoryMaximumSize;
private String compiler;
- private String javasource;
private boolean nojavac;
private boolean quiet;
private boolean verbose;
@@ -581,14 +576,6 @@ public class SchemaCompiler {
this.compiler = compiler;
}
- public String getJavaSource() {
- return javasource;
- }
-
- public void setJavaSource(String javasource) {
- this.javasource = javasource;
- }
-
public Collection<XmlError> getErrorListener() {
return errorListener;
}
@@ -650,7 +637,7 @@ public class SchemaCompiler {
File[] javaFiles, ResourceLoader cpResourceLoader,
boolean download, boolean noUpa, boolean noPvr, boolean noAnn, boolean noVDoc, boolean noExt,
Set<String> mdefNamespaces, File baseDir, Map<String, String> sourcesToCopyMap,
- Collection<XmlError> outerErrorListener, File schemasDir, EntityResolver entResolver, File[] classpath, String javasource) {
+ Collection<XmlError> outerErrorListener, File schemasDir, EntityResolver entResolver, File[] classpath) {
XmlErrorWatcher errorListener = new XmlErrorWatcher(outerErrorListener);
// construct the state (have to initialize early in case of errors)
@@ -818,9 +805,6 @@ public class SchemaCompiler {
}
opts.setCompileNoValidation(); // already validated here
opts.setEntityResolver(entResolver);
- if (javasource != null) {
- opts.setGenerateJavaVersion(javasource);
- }
// now pass it to the main compile function
SchemaTypeSystemCompiler.Parameters params = new SchemaTypeSystemCompiler.Parameters();
@@ -895,7 +879,6 @@ public class SchemaCompiler {
File srcDir = params.getSrcDir();
File classesDir = params.getClassesDir();
String compiler = params.getCompiler();
- String javasource = params.getJavaSource();
String memoryInitialSize = params.getMemoryInitialSize();
String memoryMaximumSize = params.getMemoryMaximumSize();
boolean nojavac = params.isNojavac();
@@ -961,7 +944,7 @@ public class SchemaCompiler {
XmlErrorWatcher errorListener = new XmlErrorWatcher(outerErrorListener);
SchemaTypeSystem system = loadTypeSystem(name, xsdFiles, wsdlFiles, urlFiles, configFiles,
javaFiles, cpResourceLoader, download, noUpa, noPvr, noAnn, noVDoc, noExt, mdefNamespaces,
- baseDir, sourcesToCopyMap, errorListener, schemasDir, cmdLineEntRes, classpath, javasource);
+ baseDir, sourcesToCopyMap, errorListener, schemasDir, cmdLineEntRes, classpath);
if (errorListener.hasError()) {
result = false;
}
@@ -984,9 +967,6 @@ public class SchemaCompiler {
if (codePrinter != null) {
options.setSchemaCodePrinter(codePrinter);
}
- if (javasource != null) {
- options.setGenerateJavaVersion(javasource);
- }
// save .xsb files
system.save(filer);
@@ -1016,7 +996,7 @@ public class SchemaCompiler {
if (javaFiles != null) {
sourcefiles.addAll(java.util.Arrays.asList(javaFiles));
}
- if (!CodeGenUtil.externalCompile(sourcefiles, classesDir, classpath, debug, compiler, javasource, memoryInitialSize, memoryMaximumSize, quiet, verbose)) {
+ if (!CodeGenUtil.externalCompile(sourcefiles, classesDir, classpath, debug, compiler, memoryInitialSize, memoryMaximumSize, quiet, verbose)) {
result = false;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org