You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by kk...@apache.org on 2005/01/14 01:23:55 UTC
svn commit: r125124 - in xmlbeans/trunk: src/typeimpl/org/apache/xmlbeans/impl/schema src/typeimpl/org/apache/xmlbeans/impl/util src/xmlcomp/org/apache/xmlbeans/impl/tool src/xmlpublic/org/apache/xmlbeans test/src/xmlobject/detailed
Author: kkrouse
Date: Thu Jan 13 16:23:54 2005
New Revision: 125124
URL: http://svn.apache.org/viewcvs?view=rev&rev=125124
Log:
added java 1.5 generics to generated source:
- to use, pass '-javasource 1.5' to scomp
- generates a 'List<Item> getItemList()' method
- runtime is still all jdk 1.4, only 1.5 in gen'd source
Modified:
xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/util/HexBin.java
xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/CodeGenUtil.java
xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCompiler.java
xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/XmlOptions.java
xmlbeans/trunk/test/src/xmlobject/detailed/XmlObjectAbstractClassTest.java
Modified: xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java?view=diff&rev=125124&p1=xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java&r1=125123&p2=xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java&r2=125124
==============================================================================
--- xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java (original)
+++ xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java Thu Jan 13 16:23:54 2005
@@ -44,6 +44,8 @@
{
Writer _writer;
int _indent;
+ boolean _useJava15;
+
static final String LINE_SEPARATOR =
System.getProperty("line.separator") == null
@@ -69,6 +71,7 @@
getPrinter(opt).printType( writer, sType );
}
+ /** @deprecated */
public static void printLoader ( Writer writer, SchemaTypeSystem system,
XmlOptions opt )
throws IOException
@@ -82,14 +85,24 @@
(opt, XmlOptions.SCHEMA_CODE_PRINTER);
if (printer == null || !(printer instanceof SchemaCodePrinter))
{
- printer = new SchemaTypeCodePrinter();
+ printer = new SchemaTypeCodePrinter(opt);
}
return (SchemaCodePrinter) printer;
}
- public SchemaTypeCodePrinter ()
+ public SchemaTypeCodePrinter (XmlOptions opt)
{
_indent = 0;
+
+ String genversion = null;
+
+ if (opt != null && XmlOptions.hasOption(opt, XmlOptions.GENERATE_JAVA_VERSION))
+ genversion = (String)opt.get(XmlOptions.GENERATE_JAVA_VERSION);
+
+ if (genversion == null)
+ genversion = XmlOptions.GENERATE_JAVA_14;
+
+ _useJava15 = XmlOptions.GENERATE_JAVA_15.equals(genversion);
}
void indent()
@@ -855,6 +868,39 @@
return (sType.isSimpleType() && sType.getSimpleVariety() == SchemaType.UNION);
}
+ static boolean isJavaPrimitive(int javaType)
+ {
+ return (javaType < SchemaProperty.JAVA_FIRST_PRIMITIVE ? false :
+ (javaType > SchemaProperty.JAVA_LAST_PRIMITIVE ? false : true));
+ }
+
+ /** Returns the wrapped type for a java primitive. */
+ static String javaWrappedType(int javaType)
+ {
+ switch (javaType)
+ {
+ case SchemaProperty.JAVA_BOOLEAN:
+ return "java.lang.Boolean";
+ case SchemaProperty.JAVA_FLOAT:
+ return "java.lang.Float";
+ case SchemaProperty.JAVA_DOUBLE:
+ return "java.lang.Double";
+ case SchemaProperty.JAVA_BYTE:
+ return "java.lang.Byte";
+ case SchemaProperty.JAVA_SHORT:
+ return "java.lang.Short";
+ case SchemaProperty.JAVA_INT:
+ return "java.lang.Integer";
+ case SchemaProperty.JAVA_LONG:
+ return "java.lang.Long";
+
+ // anything else is not a java primitive
+ default:
+ assert false;
+ throw new IllegalStateException();
+ }
+ }
+
String javaTypeForProperty(SchemaProperty sProp)
{
// The type to use is the XML object....
@@ -953,6 +999,16 @@
{
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();");
+ }
+
printJavaDoc("Gets array of all " + propdesc + "s");
emit(type + "[] get" + arrayName + "();");
@@ -961,6 +1017,12 @@
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) array of all " + propdesc + "s");
emit(xtype + "[] xget" + arrayName + "();");
@@ -1056,14 +1118,11 @@
emit("void add" + propertyName + "(" + type + " " + safeVarName + ");");
}
- if (xmltype)
- {
- 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);
+ emit(xtype + " insertNew" + propertyName + "(int i);");
- 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);
+ emit(xtype + " addNew" + propertyName + "();");
printJavaDoc("Removes the ith " + propdesc);
emit("void remove" + propertyName + "(int i);");
@@ -1712,7 +1771,76 @@
endBlock();
}
- void printGetterImpls(
+ void printListGetter15Impl(String parentJavaName,
+ String propdesc, String propertyName,
+ String wrappedType, String xtype,
+ boolean xmltype, boolean xget)
+ throws IOException
+ {
+ String arrayName = propertyName + "Array";
+ String listName = propertyName + "List";
+ String parentThis = parentJavaName + ".this.";
+
+ String xgetMethod = (xget ? "x" : "") + "get";
+ String xsetMethod = (xget ? "x" : "") + "set";
+
+ printJavaDoc("Gets " + (xget ? "(as xml) " : "") + "a List of " + propdesc + "s");
+
+ emit("public java.util.List<" + wrappedType + "> " + xgetMethod + listName + "()");
+ startBlock();
+
+ emit("final class " + listName + " extends java.util.AbstractList<" + wrappedType + ">");
+ startBlock();
+
+ // Object get(i)
+ emit("public " + wrappedType + " get(int i)");
+ emit(" { return " + parentThis + xgetMethod + arrayName + "(i); }");
+ emit("");
+
+ // Object set(i, o)
+ 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("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("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("public int size()");
+ emit(" { return " + parentThis + "sizeOf" + arrayName + "(); }");
+ emit("");
+
+ endBlock();
+
+ emit("");
+
+ emitImplementationPreamble();
+
+ emit("return new " + listName + "();");
+
+ 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,
@@ -1815,6 +1943,17 @@
{
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);
+ }
+
// Value[] getProp()
printJavaDoc("Gets array of all " + propdesc + "s");
emit("public " + type + "[] get" + arrayName + "()");
@@ -1843,6 +1982,11 @@
if (!xmltype)
{
+ if (_useJava15)
+ {
+ printListGetter15Impl(parentJavaName, propdesc, propertyName, xtype, xtype, xmltype, true);
+ }
+
// Value[] xgetProp()
printJavaDoc("Gets (as xml) array of all " + propdesc + "s");
emit("public " + xtype + "[] xget" + arrayName + "()");
@@ -2101,32 +2245,29 @@
endBlock();
}
- if (xmltype)
- {
- printJavaDoc("Inserts and returns a new empty value (as xml) as the ith " + propdesc);
- emit("public " + xtype + " insertNew" + propertyName + "(int i)");
- startBlock();
- emitImplementationPreamble();
- emitDeclareTarget(true, xtype);
- emitPre(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr, "i");
- emit("target = (" + xtype + ")get_store().insert_element_user(" + identifier + ", i);");
- emitPost(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr, "i");
- emit("return target;");
- emitImplementationPostamble();
- endBlock();
+ printJavaDoc("Inserts and returns a new empty value (as xml) as the ith " + propdesc);
+ emit("public " + xtype + " insertNew" + propertyName + "(int i)");
+ startBlock();
+ emitImplementationPreamble();
+ emitDeclareTarget(true, xtype);
+ emitPre(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr, "i");
+ emit("target = (" + xtype + ")get_store().insert_element_user(" + identifier + ", i);");
+ 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();
- emitDeclareTarget(true, xtype);
- emitPre(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr);
- emitAddTarget(identifier, isAttr, true, xtype);
- emitPost(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr);
- 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();
+ emitDeclareTarget(true, xtype);
+ emitPre(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr);
+ emitAddTarget(identifier, isAttr, true, 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)");
@@ -2198,6 +2339,7 @@
String xmlType = xmlTypeForProperty( prop );
printGetterImpls(
+ shortName,
prop,
name,
prop.isAttribute(),
Modified: xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/util/HexBin.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/util/HexBin.java?view=diff&rev=125124&p1=xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/util/HexBin.java&r1=125123&p2=xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/util/HexBin.java&r2=125124
==============================================================================
--- xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/util/HexBin.java (original)
+++ xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/util/HexBin.java Thu Jan 13 16:23:54 2005
@@ -126,14 +126,12 @@
return null;
byte[] decoded = null;
- try {
+ try {
decoded = decode(binaryData.getBytes("utf-8"));
}
catch(UnsupportedEncodingException e) {
- }
- finally {
- return decoded == null ? null : new String(decoded);
}
+ return decoded == null ? null : new String(decoded);
}
/**
@@ -147,13 +145,11 @@
return null;
byte[] encoded = null;
- try {
+ try {
encoded = encode(binaryData.getBytes("utf-8"));
}
catch(UnsupportedEncodingException e) {}
- finally {
- return encoded == null ? null : new String(encoded);
- }
+ return encoded == null ? null : new String(encoded);
}
}
Modified: xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/CodeGenUtil.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/CodeGenUtil.java?view=diff&rev=125124&p1=xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/CodeGenUtil.java&r1=125123&p2=xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/CodeGenUtil.java&r2=125124
==============================================================================
--- xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/CodeGenUtil.java (original)
+++ xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/CodeGenUtil.java Thu Jan 13 16:23:54 2005
@@ -110,7 +110,7 @@
*/
static public boolean externalCompile(List srcFiles, File outdir, File[] cp, boolean debug)
{
- return externalCompile(srcFiles, outdir, cp, debug, DEFAULT_COMPILER, DEFAULT_MEM_START, DEFAULT_MEM_MAX, false, false);
+ return externalCompile(srcFiles, outdir, cp, debug, DEFAULT_COMPILER, null, DEFAULT_MEM_START, DEFAULT_MEM_MAX, false, false);
}
/**
@@ -119,7 +119,7 @@
* <code>GenFile</code>s for all of the classes produced or null if an
* error occurred.
*/
- static public boolean externalCompile(List srcFiles, File outdir, File[] cp, boolean debug, String javacPath, String memStart, String memMax, boolean quiet, boolean verbose)
+ static public boolean externalCompile(List srcFiles, File outdir, File[] cp, boolean debug, String javacPath, String genver, String memStart, String memMax, boolean quiet, boolean verbose)
{
List args = new ArrayList();
@@ -163,8 +163,14 @@
args.add(quoteAndEscapeFilename(classPath.toString()));
}
+ if (genver == null)
+ genver = "1.4";
+
args.add("-source");
- args.add("1.4");
+ args.add(genver);
+
+ args.add("-target");
+ args.add(genver);
args.add(debug ? "-g" : "-g:none");
@@ -263,11 +269,6 @@
}
return (File[])cp.toArray(new File[cp.size()]);
}
-
- //Note - I have added a new class, JarHelper, in impl.common which provides
- //more jarring functionality and does not require invoking jar.exe. You
- //may want to consider migrating your code to use this as it will be
- //considerably faster. pcal 12/10/2003
/**
* @deprecated Use org.apache.xmlbeans.impl.common.JarHelper instead.
Modified: xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCompiler.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCompiler.java?view=diff&rev=125124&p1=xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCompiler.java&r1=125123&p2=xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCompiler.java&r2=125124
==============================================================================
--- xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCompiler.java (original)
+++ xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCompiler.java Thu Jan 13 16:23:54 2005
@@ -68,6 +68,7 @@
System.out.println(" -noann - ignore annotations");
System.out.println(" -novdoc - do not validate contents of <documentation>");
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");
@@ -84,7 +85,6 @@
System.out.println(" -schemaCodePrinter - specify SchemaCodePrinter class");
*/
System.out.println();
- System.out.println("If you require a different java compiler, use the XMLBean Ant task instead.");
}
public static void main(String[] args)
@@ -119,6 +119,7 @@
opts.add("d");
opts.add("cp");
opts.add("compiler");
+ opts.add("javasource");
opts.add("jar"); // deprecated
opts.add("ms");
opts.add("mx");
@@ -295,6 +296,7 @@
classpath = CodeGenUtil.systemClasspath();
}
+ String javasource = cl.getOpt("javasource");
String compiler = cl.getOpt("compiler");
String jar = cl.getOpt("jar");
if (verbose && jar != null)
@@ -334,6 +336,7 @@
params.setSrcDir(src);
params.setClassesDir(classes);
params.setCompiler(compiler);
+ params.setGenerateJavaVersion(javasource);
params.setMemoryInitialSize(memoryInitialSize);
params.setMemoryMaximumSize(memoryMaximumSize);
params.setNojavac(nojavac);
@@ -379,6 +382,7 @@
private String memoryInitialSize;
private String memoryMaximumSize;
private String compiler;
+ private String javasource;
private boolean nojavac;
private boolean quiet;
private boolean verbose;
@@ -630,11 +634,21 @@
{
return compiler;
}
-
+
public void setCompiler(String compiler)
{
this.compiler = compiler;
}
+
+ public String getGenerateJavaVersion()
+ {
+ return javasource;
+ }
+
+ public void setGenerateJavaVersion(String javasource)
+ {
+ this.javasource = javasource;
+ }
/** @deprecated */
public String getJar()
@@ -711,7 +725,7 @@
File[] javaFiles, ResourceLoader cpResourceLoader,
boolean download, boolean noUpa, boolean noPvr, boolean noAnn, boolean noVDoc,
Set mdefNamespaces, File baseDir, Map sourcesToCopyMap,
- Collection outerErrorListener, File schemasDir, EntityResolver entResolver, File[] classpath)
+ Collection outerErrorListener, File schemasDir, EntityResolver entResolver, File[] classpath, String javasource)
{
XmlErrorWatcher errorListener = new XmlErrorWatcher(outerErrorListener);
@@ -899,6 +913,8 @@
opts.setCompileMdefNamespaces(mdefNamespaces);
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();
@@ -972,6 +988,7 @@
File srcDir = params.getSrcDir();
File classesDir = params.getClassesDir();
String compiler = params.getCompiler();
+ String javasource = params.getGenerateJavaVersion();
String memoryInitialSize = params.getMemoryInitialSize();
String memoryMaximumSize = params.getMemoryMaximumSize();
boolean nojavac = params.isNojavac();
@@ -1030,7 +1047,7 @@
XmlErrorWatcher errorListener = new XmlErrorWatcher(outerErrorListener);
SchemaTypeSystem system = loadTypeSystem(name, xsdFiles, wsdlFiles, urlFiles, configFiles,
javaFiles, cpResourceLoader, download, noUpa, noPvr, noAnn, noVDoc, mdefNamespaces,
- baseDir, sourcesToCopyMap, errorListener, schemasDir, cmdLineEntRes, classpath);
+ baseDir, sourcesToCopyMap, errorListener, schemasDir, cmdLineEntRes, classpath, javasource);
if (errorListener.hasError())
result = false;
long finish = System.currentTimeMillis();
@@ -1046,10 +1063,11 @@
Repackager repackager = (repackage == null ? null : new Repackager(repackage));
FilerImpl filer = new FilerImpl(classesDir, srcDir, repackager, verbose, incrSrcGen);
- // currently just for schemaCodePrinter
XmlOptions options = new XmlOptions();
if (codePrinter != null)
options.setSchemaCodePrinter(codePrinter);
+ if (javasource != null)
+ options.setGenerateJavaVersion(javasource);
// save .xsb files
system.save(filer);
@@ -1073,7 +1091,7 @@
if (javaFiles != null)
sourcefiles.addAll(java.util.Arrays.asList(javaFiles));
- if (!CodeGenUtil.externalCompile(sourcefiles, classesDir, classpath, debug, compiler, memoryInitialSize, memoryMaximumSize, quiet, verbose))
+ if (!CodeGenUtil.externalCompile(sourcefiles, classesDir, classpath, debug, compiler, javasource, memoryInitialSize, memoryMaximumSize, quiet, verbose))
result = false;
finish = System.currentTimeMillis();
Modified: xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/XmlOptions.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/XmlOptions.java?view=diff&rev=125124&p1=xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/XmlOptions.java&r1=125123&p2=xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/XmlOptions.java&r2=125124
==============================================================================
--- xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/XmlOptions.java (original)
+++ xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/XmlOptions.java Thu Jan 13 16:23:54 2005
@@ -624,6 +624,25 @@
return set( SCHEMA_CODE_PRINTER, printer );
}
+ /**
+ * If this option is set, then the schema compiler will print java code
+ * that is compatible with the desired Java version. If not set, the
+ * current Java version is used. Currently, only "1.4" and "1.5" are
+ * supported.
+ *
+ * @param source A Java version number
+ *
+ * @see GENERATE_JAVA_14
+ * @see GENERATE_JAVA_15
+ * @see XmlBeans#compileXmlBeans
+ */
+ public XmlOptions setGenerateJavaVersion (String source) {
+ return set( GENERATE_JAVA_VERSION, source );
+ }
+
+ public static final String GENERATE_JAVA_14 = "1.4";
+ public static final String GENERATE_JAVA_15 = "1.5";
+
//
// Complete set of XmlOption's
//
@@ -717,6 +736,8 @@
public static final String ENTITY_RESOLVER = "ENTITY_RESOLVER";
/** @exclude */
public static final String SCHEMA_CODE_PRINTER = "SCHEMA_CODE_PRINTER";
+ /** @exclude */
+ public static final String GENERATE_JAVA_VERSION = "GENERATE_JAVA_VERSION";
private static final XmlOptions EMPTY_OPTIONS;
static {
Modified: xmlbeans/trunk/test/src/xmlobject/detailed/XmlObjectAbstractClassTest.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/src/xmlobject/detailed/XmlObjectAbstractClassTest.java?view=diff&rev=125124&p1=xmlbeans/trunk/test/src/xmlobject/detailed/XmlObjectAbstractClassTest.java&r1=125123&p2=xmlbeans/trunk/test/src/xmlobject/detailed/XmlObjectAbstractClassTest.java&r2=125124
==============================================================================
--- xmlbeans/trunk/test/src/xmlobject/detailed/XmlObjectAbstractClassTest.java (original)
+++ xmlbeans/trunk/test/src/xmlobject/detailed/XmlObjectAbstractClassTest.java Thu Jan 13 16:23:54 2005
@@ -67,7 +67,7 @@
srcFiles.add(source);
if (!CodeGenUtil.externalCompile(srcFiles, dir, classpath, false,
- CodeGenUtil.DEFAULT_COMPILER, CodeGenUtil.DEFAULT_MEM_START,
+ CodeGenUtil.DEFAULT_COMPILER, null, CodeGenUtil.DEFAULT_MEM_START,
CodeGenUtil.DEFAULT_MEM_MAX, false, false)){
return false;
}
@@ -140,4 +140,4 @@
public static void main(String args[]) throws Exception {
new XmlObjectAbstractClassTest("test").testAbstractBaseClass();
}
-}
\ No newline at end of file
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: commits-help@xmlbeans.apache.org