164
165
166 public Options() {
167 try {
168 Class.forName("javax.xml.bind.JAXBPermission");
169 } catch (ClassNotFoundException cnfe) {
170 target = SpecVersion.V2_1;
171 }
172 }
173
174 /**
175 * Target directory when producing files.
176 * <p>
177 * This field is not used when XJC is driven through the XJC API.
178 * Plugins that need to generate extra files should do so by using
179 * {@link JPackage#addResourceFile(JResourceFile)}.
180 */
181 public File targetDir = new File(".");
182
183 /**
184 * Actually stores {@link CatalogResolver}, but the field
185 * type is made to {@link EntityResolver} so that XJC can be
186 * used even if resolver.jar is not available in the classpath.
187 */
188 public EntityResolver entityResolver = null;
189
190 /**
191 * Type of input schema language. One of the {@code SCHEMA_XXX}
192 * constants.
193 */
194 private Language schemaLanguage = null;
195
196 /**
197 * The -p option that should control the default Java package that
198 * will contain the generated code. Null if unspecified.
199 */
200 public String defaultPackage = null;
201
202 /**
203 * Similar to the -p option, but this one works with a lower priority,
204 * and customizations overrides this. Used by JAX-RPC.
205 */
206 public String defaultPackage2 = null;
622 return 2;
623 }
624 if (args[i].equals("-httpproxy")) {
625 if (i == args.length - 1 || args[i + 1].startsWith("-")) {
626 throw new BadCommandLineException(
627 Messages.format(Messages.MISSING_PROXY));
628 }
629
630 parseProxy(args[++i]);
631 return 2;
632 }
633 if (args[i].equals("-host")) {
634 proxyHost = requireArgument("-host",args,++i);
635 return 2;
636 }
637 if (args[i].equals("-port")) {
638 proxyPort = requireArgument("-port",args,++i);
639 return 2;
640 }
641 if( args[i].equals("-catalog") ) {
642 // use javax.xml.catalog to resolve external entities.
643
644 File catalogFile = new File(requireArgument("-catalog",args,++i));
645 try {
646 addCatalog(catalogFile);
647 } catch (IOException e) {
648 throw new BadCommandLineException(
649 Messages.format(Messages.FAILED_TO_PARSE,catalogFile,e.getMessage()),e);
650 }
651 return 2;
652 }
653 if( args[i].equals("-Xtest-class-name-allocator") ) {
654 classNameAllocator = new ClassNameAllocator() {
655 public String assignClassName(String packageName, String className) {
656 System.out.printf("assignClassName(%s,%s)\n",packageName,className);
657 return className+"_Type";
658 }
659 };
660 return 1;
661 }
662
|
164
165
166 public Options() {
167 try {
168 Class.forName("javax.xml.bind.JAXBPermission");
169 } catch (ClassNotFoundException cnfe) {
170 target = SpecVersion.V2_1;
171 }
172 }
173
174 /**
175 * Target directory when producing files.
176 * <p>
177 * This field is not used when XJC is driven through the XJC API.
178 * Plugins that need to generate extra files should do so by using
179 * {@link JPackage#addResourceFile(JResourceFile)}.
180 */
181 public File targetDir = new File(".");
182
183 /**
184 * Stores {@link EntityResolver}.
185 */
186 public EntityResolver entityResolver = null;
187
188 /**
189 * Type of input schema language. One of the {@code SCHEMA_XXX}
190 * constants.
191 */
192 private Language schemaLanguage = null;
193
194 /**
195 * The -p option that should control the default Java package that
196 * will contain the generated code. Null if unspecified.
197 */
198 public String defaultPackage = null;
199
200 /**
201 * Similar to the -p option, but this one works with a lower priority,
202 * and customizations overrides this. Used by JAX-RPC.
203 */
204 public String defaultPackage2 = null;
620 return 2;
621 }
622 if (args[i].equals("-httpproxy")) {
623 if (i == args.length - 1 || args[i + 1].startsWith("-")) {
624 throw new BadCommandLineException(
625 Messages.format(Messages.MISSING_PROXY));
626 }
627
628 parseProxy(args[++i]);
629 return 2;
630 }
631 if (args[i].equals("-host")) {
632 proxyHost = requireArgument("-host",args,++i);
633 return 2;
634 }
635 if (args[i].equals("-port")) {
636 proxyPort = requireArgument("-port",args,++i);
637 return 2;
638 }
639 if( args[i].equals("-catalog") ) {
640 // use Sun's "XML Entity and URI Resolvers" by Norman Walsh
641 // to resolve external entities.
642 // https://xerces.apache.org/xml-commons/components/resolver/resolver-article.html
643
644 File catalogFile = new File(requireArgument("-catalog",args,++i));
645 try {
646 addCatalog(catalogFile);
647 } catch (IOException e) {
648 throw new BadCommandLineException(
649 Messages.format(Messages.FAILED_TO_PARSE,catalogFile,e.getMessage()),e);
650 }
651 return 2;
652 }
653 if( args[i].equals("-Xtest-class-name-allocator") ) {
654 classNameAllocator = new ClassNameAllocator() {
655 public String assignClassName(String packageName, String className) {
656 System.out.printf("assignClassName(%s,%s)\n",packageName,className);
657 return className+"_Type";
658 }
659 };
660 return 1;
661 }
662
|