You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by ra...@apache.org on 2009/05/08 00:20:13 UTC

svn commit: r772792 - /xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java

Author: radup
Date: Thu May  7 22:20:12 2009
New Revision: 772792

URL: http://svn.apache.org/viewvc?rev=772792&view=rev
Log:
Add @Deprecated and @Override annotations to the generated methods if 1.5 level is selected. Contributed by Wesley Leggette.

Modified:
    xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java

Modified: xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java?rev=772792&r1=772791&r2=772792&view=diff
==============================================================================
--- xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java (original)
+++ xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java Thu May  7 22:20:12 2009
@@ -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");
@@ -1966,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);");
@@ -1980,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); }");
@@ -1988,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);");
@@ -1997,6 +2051,8 @@
         emit("");
 
         // int size()
+        if (_useJava15)
+            emit("@Override");
         emit("public int size()");
         emit("    { return " + parentThis + "sizeOf" + arrayName + "(); }");
         emit("");
@@ -2136,6 +2192,7 @@
                 emit(" * Gets array of all " + propdesc + "s");
                 emit(" * @deprecated");
                 emit(" */");
+                emit("@Deprecated");
             }
             else
                 printJavaDoc("Gets array of all " + propdesc + "s");
@@ -2181,6 +2238,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: commits-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: commits-help@xmlbeans.apache.org