Exemplo n.º 1
0
 protected int unknownArgument(String[] args, String arg, int argNum) {
   if (arg == "-t") {
     arg = args[++argNum];
     if (arg.equalsIgnoreCase("parse")) setTraceParse(true);
     else if (arg.equalsIgnoreCase("gen")) setTraceGen(true);
     else if (arg.equalsIgnoreCase("dot")) setTraceDot(true);
     else {
       if (!arg.equalsIgnoreCase("all"))
         --argNum; // unknown value, trace all, and rethink that option
       setTraceParse(true);
       setTraceGen(true);
       setTraceMisc(true);
       setTraceDot(true);
     }
   } else if (arg == "-version") {
     messageOut.println("schema2beans - " + Version.getVersion());
     System.exit(0);
   } else if (arg == "-xmlschema") setSchemaTypeNum(XML_SCHEMA);
   else if (arg == "-dtd") setSchemaTypeNum(DTD);
   else if (arg == "-premium") buyPremium();
   else if (arg == "-strict") useStrict();
   else if (arg == "-basebean") {
     setOutputType(OUTPUT_TRADITIONAL_BASEBEAN);
   } else if (arg == "-javabeans") setOutputType(OUTPUT_JAVABEANS);
   else if (arg == "-commoninterface") setGenerateCommonInterface(COMMON_BEAN);
   else if (arg == "-nocommoninterface") setGenerateCommonInterface(null);
   else {
     messageOut.println("Unknown argument: " + arg);
     messageOut.println("Use -help.");
     System.exit(1);
   }
   return argNum;
 }
Exemplo n.º 2
0
 public void setForME(boolean value) {
   super.setForME(value);
   if (value) {
     setOutputType(OUTPUT_JAVABEANS);
     setGeneratePropertyEvents(false);
     setIndexedPropertyType(null);
   }
 }
Exemplo n.º 3
0
 /** For those who are more concerned with correctness than backwards compatibility. */
 public void useStrict() {
   setSetDefaults(true);
   setStandalone(true);
   setDumpToString(true);
   setThrowErrors(true);
   setGenerateXMLIO(true);
   setGenerateValidate(true);
   setAttributesAsProperties(true);
   setRespectExtension(true);
   setOutputType(OUTPUT_JAVABEANS);
 }
Exemplo n.º 4
0
 /** Turn on a bunch of the great switches that arn't on by default. */
 public void buyPremium() {
   setSetDefaults(true);
   setStandalone(true);
   setDumpToString(true);
   setThrowErrors(true);
   setGenerateXMLIO(true);
   setGenerateValidate(true);
   setAttributesAsProperties(true);
   setGenerateInterfaces(true);
   setOptionalScalars(true);
   setRespectExtension(true);
   setLogSuspicious(true);
   setGenerateCommonInterface(COMMON_BEAN);
   setOutputType(OUTPUT_JAVABEANS);
 }
Exemplo n.º 5
0
 public void setOutputType(int type) {
   if (type == OUTPUT_JAVABEANS) {
     setCodeGeneratorFactory(JavaBeansFactory.newInstance());
     setAttributesAsProperties(true);
   } else if (type == OUTPUT_TRADITIONAL_BASEBEAN) {
     if (false) {
       // Force extendBaseBean option
       setOutputType(OUTPUT_JAVABEANS);
       setExtendBaseBean(true);
     } else {
       setCodeGeneratorFactory(null);
       setProcessComments(false); // we already do it anyway
     }
   } else {
     throw new IllegalArgumentException(
         "type != OUTPUT_JAVABEANS && type != OUTPUT_TRADITIONAL_BASEBEAN"); // NOI18N
   }
 }
Exemplo n.º 6
0
 public void setMinFeatures(boolean value) {
   super.setMinFeatures(value);
   if (value) {
     setOutputType(OUTPUT_JAVABEANS);
     setGenerateXMLIO(false);
     setGenerateValidate(false);
     setGenerateInterfaces(false);
     setGenerateCommonInterface(null);
     setGeneratePropertyEvents(false);
     setGenerateStoreEvents(false);
     setGenerateTransactions(false);
     setDefaultsAccessable(false);
     setKeepElementPositions(false);
     setRemoveUnreferencedNodes(true);
     setProcessComments(false);
     setProcessDocType(false);
     setGenerateParentRefs(false);
     setGenerateHasChanged(false);
   }
 }