You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by wl...@cleversafe.com on 2009/05/07 07:24:29 UTC
[PATCH 0 of 3] Adding annotations for 1.5 output,
fixing unnecessary cast
Some minor cleanups, resubmitted as requested.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org
[PATCH 2 of 3] imported patch annotation-fixes.patch
Posted by wl...@cleversafe.com.
# HG changeset patch
# User wleggette
# Date 1241673411 18000
# Node ID a1a0fd69fc89eb1a13b01ac96364ce5caba51b35
# Parent 0540c66e9de4596f52f6efd968f94a8bce70db6b
imported patch annotation-fixes.patch
diff -r 0540c66e9de4 -r a1a0fd69fc89 src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
--- a/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java Thu May 07 00:14:26 2009 -0500
+++ b/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java Thu May 07 00:16:51 2009 -0500
@@ -463,15 +463,21 @@
}
// Only need newInstance() for non-abstract types
- if (sType.isAbstract())
+ 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 + ") org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, null ); }");
emit("");
// Only need newInstance() for non-abstract types
- if (sType.isAbstract())
+ 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 + ") org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, options ); }");
emit("");
@@ -537,23 +543,31 @@
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 + ") org.apache.xmlbeans.XmlBeans.getContextTypeLoader().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 + ") org.apache.xmlbeans.XmlBeans.getContextTypeLoader().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 org.apache.xmlbeans.XmlBeans.getContextTypeLoader().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 org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }");
emit("");
@@ -713,8 +727,12 @@
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)
@@ -722,8 +740,12 @@
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)
@@ -731,8 +753,12 @@
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)
@@ -740,8 +766,12 @@
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)
@@ -749,8 +779,12 @@
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);");
}
}
@@ -761,8 +795,12 @@
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();
@@ -776,10 +814,16 @@
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);");
}
}
@@ -1149,6 +1193,7 @@
emit(" * Gets array of all " + propdesc + "s");
emit(" * @deprecated");
emit(" */");
+ emit("@Deprecated");
}
else
printJavaDoc("Gets array of all " + propdesc + "s");
@@ -1172,6 +1217,7 @@
emit(" * Gets (as xml) array of all " + propdesc + "s");
emit(" * @deprecated");
emit(" */");
+ emit("@Deprecated");
}
else
printJavaDoc("Gets (as xml) array of all " + propdesc + "s");
@@ -2136,6 +2182,7 @@
emit(" * Gets array of all " + propdesc + "s");
emit(" * @deprecated");
emit(" */");
+ emit("@Deprecated");
}
else
printJavaDoc("Gets array of all " + propdesc + "s");
@@ -2181,6 +2228,7 @@
emit(" * Gets array of all " + propdesc + "s");
emit(" * @deprecated");
emit(" */");
+ emit("@Deprecated");
}
else
printJavaDoc("Gets (as xml) array of all " + propdesc + "s");
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org
[PATCH 1 of 3] Removed some unnecessary casts from generated code
Posted by wl...@cleversafe.com.
# HG changeset patch
# User wleggette
# Date 1241673266 18000
# Node ID 0540c66e9de4596f52f6efd968f94a8bce70db6b
# Parent 7d90afb34b6694ea8fb8ad1d2a273d5d6500a24e
Removed some unnecessary casts from generated code.
diff -r 7d90afb34b66 -r 0540c66e9de4 src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
--- a/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java Thu May 07 00:10:11 2009 -0500
+++ b/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java Thu May 07 00:14:26 2009 -0500
@@ -2204,7 +2204,7 @@
startBlock();
emitImplementationPreamble();
emitGetTarget(setIdentifier, identifier, isAttr, "i", THROW_EXCEPTION, xtype);
- emit("return (" + xtype + ")target;");
+ emit("return target;");
emitImplementationPostamble();
endBlock();
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org
[PATCH 3 of 3] Adds @Override annotation to appropriate generated
methods if 1.5 level is selected
Posted by wl...@cleversafe.com.
# HG changeset patch
# User wleggette
# Date 1241673797 18000
# Node ID b5a21d5074b4963ecc82dc2f79f170f22a85d821
# Parent a1a0fd69fc89eb1a13b01ac96364ce5caba51b35
Adds @Override annotation to appropriate generated methods if 1.5 level is selected.
diff -r a1a0fd69fc89 -r b5a21d5074b4 src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
--- a/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java Thu May 07 00:16:51 2009 -0500
+++ b/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java Thu May 07 00:23:17 2009 -0500
@@ -2012,11 +2012,15 @@
startBlock();
// Object get(i)
+ if (_useJava15)
+ emit("@Override");
emit("public " + wrappedType + " get(int i)");
emit(" { return " + parentThis + xgetMethod + arrayName + "(i); }");
emit("");
// Object set(i, o)
+ if (_useJava15)
+ emit("@Override");
emit("public " + wrappedType + " set(int i, " + wrappedType + " o)");
startBlock();
emit(wrappedType + " old = " + parentThis + xgetMethod + arrayName + "(i);");
@@ -2026,6 +2030,8 @@
emit("");
// void add(i, o)
+ if (_useJava15)
+ emit("@Override");
emit("public void add(int i, " + wrappedType +" o)");
if (xmltype || xget)
emit(" { " + parentThis + "insertNew" + propertyName + "(i).set(o); }");
@@ -2034,6 +2040,8 @@
emit("");
// Object remove(i)
+ if (_useJava15)
+ emit("@Override");
emit("public " + wrappedType +" remove(int i)");
startBlock();
emit(wrappedType + " old = " + parentThis + xgetMethod + arrayName + "(i);");
@@ -2043,6 +2051,8 @@
emit("");
// int size()
+ if (_useJava15)
+ emit("@Override");
emit("public int size()");
emit(" { return " + parentThis + "sizeOf" + arrayName + "(); }");
emit("");
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org