当前位置: 首页>>代码示例>>Java>>正文


Java BadCommandLineException类代码示例

本文整理汇总了Java中com.sun.tools.xjc.BadCommandLineException的典型用法代码示例。如果您正苦于以下问题:Java BadCommandLineException类的具体用法?Java BadCommandLineException怎么用?Java BadCommandLineException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BadCommandLineException类属于com.sun.tools.xjc包,在下文中一共展示了BadCommandLineException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseArgument

import com.sun.tools.xjc.BadCommandLineException; //导入依赖的package包/类
@Override
public int parseArgument(Options opt, String[] args, int start)
		throws BadCommandLineException, IOException {
	final int result = super.parseArgument(opt, args, start);

	for (int i = 0; i < args.length; i++) {
		if (args[i].length() != 0) {
			if (args[i].charAt(0) != '-') {
				if (args[i].endsWith(".jar")) {
					episodeURLs.add(new File(args[i]).toURI().toURL());
				}
			}
		}
	}
	return result;
}
 
开发者ID:highsource,项目名称:hyperjaxb3,代码行数:17,代码来源:EjbPlugin.java

示例2: onActivated

import com.sun.tools.xjc.BadCommandLineException; //导入依赖的package包/类
@Override
public void onActivated(Options options) throws BadCommandLineException {

	Thread.currentThread().setContextClassLoader(
			getClass().getClassLoader());

	super.onActivated(options);

	final FieldRendererFactory fieldRendererFactory = new FieldRendererFactory() {

		public FieldRenderer getList(JClass coreList) {
			return new UntypedListFieldRenderer(coreList);
		}
	};
	options.setFieldRendererFactory(fieldRendererFactory, this);
}
 
开发者ID:highsource,项目名称:hyperjaxb3,代码行数:17,代码来源:EjbPlugin.java

示例3: parseArgument

import com.sun.tools.xjc.BadCommandLineException; //导入依赖的package包/类
@Override
public int parseArgument(Options opt, String[] args, int index) throws BadCommandLineException, IOException {
	
	// look for the visitor-package argument since we'll use this for package name for our generated code.
    String arg = args[index];
    if (arg.startsWith("-Xvisitor-package:")) {
        packageName = arg.split(":")[1];
        return 1;
    }
    if (arg.startsWith("-Xvisitor-includeType:")) {
        includeType = "true".equalsIgnoreCase(arg.split(":")[1]);
        return 1;
    }
    if (arg.equals("-Xvisitor-includeType")) {
        includeType = true;
        return 1;
    }
    if (arg.equals("-Xvisitor-noClasses")) {
        generateClasses = false;
        return 1;
    }
    return 0;
}
 
开发者ID:massfords,项目名称:jaxb-visitor,代码行数:24,代码来源:VisitorPlugin.java

示例4: parseArgument

import com.sun.tools.xjc.BadCommandLineException; //导入依赖的package包/类
@Override
public int parseArgument(Options opt, String[] args, int i) throws BadCommandLineException, IOException {
    if (args[i].equals(JAVA_VERSION_PARAM)) {
        if (++i >= args.length)
            throw new BadCommandLineException(JAVA_VERSION_PARAM + " requires argument");
        try {
            javaVersion = Integer.parseInt(args[i]);
        } catch (NumberFormatException e) {
            throw new BadCommandLineException("Bad number format for parameter '"
                    + JAVA_VERSION_PARAM + "'. Please check plugin usage.");
        }

        return 2;
    }

    return 0;
}
 
开发者ID:buschmais,项目名称:jaxbfx,代码行数:18,代码来源:FXBeanPropertyXJCPlugin.java

示例5: parseArgument

import com.sun.tools.xjc.BadCommandLineException; //导入依赖的package包/类
@Override
public int parseArgument(final Options opt, final String[] args, final int i) throws BadCommandLineException, IOException {
    if (args[i].startsWith(BUILDER_OPTION_NAME)) {
        this.createBuilder = true;
        return 1;
    }
    if (args[i].startsWith(CCONSTRUCTOR_OPTION_NAME)) {
        this.createCConstructor = true;
        return 1;
    }
    if (args[i].startsWith(WITHIFNOTNULL_OPTION_NAME)) {
        this.createWithIfNotNullMethod = true;
        return 1;
    }
    if (args[i].startsWith(NOPUBLICCONSTRUCTOR_OPTION_NAME)) {
        this.createBuilderWithoutPublicConstructor = true;
        return 1;
    }
    return 0;
}
 
开发者ID:sabomichal,项目名称:immutable-xjc,代码行数:21,代码来源:PluginImpl.java

示例6: beforeRun

import com.sun.tools.xjc.BadCommandLineException; //导入依赖的package包/类
@Override
protected void beforeRun(Outline outline, Options options) throws Exception {
	super.beforeRun(outline, options);
	final String[] configLocations = getConfigLocations();
	if (!ArrayUtils.isEmpty(configLocations)) {
		final String configLocationsString = ArrayUtils
				.toString(configLocations);
		logger.debug("Loading application context from ["
				+ configLocationsString + "].");
		try {
			applicationContext = new FileSystemXmlApplicationContext(
					configLocations, false);
			applicationContext.setClassLoader(Thread.currentThread()
					.getContextClassLoader());
			applicationContext.refresh();
			if (getAutowireMode() != AutowireCapableBeanFactory.AUTOWIRE_NO) {
				applicationContext.getBeanFactory().autowireBeanProperties(
						this, getAutowireMode(), isDependencyCheck());
			}
		} catch (Exception ex) {
			ex.printStackTrace();
			ex.getCause().printStackTrace();
			logger.error("Error loading applicaion context from ["
					+ configLocationsString + "].", ex);
			throw new BadCommandLineException(
					"Error loading  applicaion context from ["
							+ configLocationsString + "].", ex);
		}
	}
}
 
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:31,代码来源:AbstractSpringConfigurablePlugin.java

示例7: onActivated

import com.sun.tools.xjc.BadCommandLineException; //导入依赖的package包/类
@Override
public void onActivated(Options options) throws BadCommandLineException {
	super.onActivated(options);
	try {
		init(options);
	} catch (Exception ex) {
		throw new BadCommandLineException(
				"Could not initialize the plugin [" + getOptionName()
						+ "].", ex);
	}
}
 
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:12,代码来源:AbstractPlugin.java

示例8: parseArgument

import com.sun.tools.xjc.BadCommandLineException; //导入依赖的package包/类
/**
 * Parses the arguments and injects values into the beans via properties.
 */
public int parseArgument(Options opt, String[] args, int start)
		throws BadCommandLineException, IOException {

	int consumed = 0;
	final String optionPrefix = "-" + getOptionName() + "-";
	final int optionPrefixLength = optionPrefix.length();

	final String arg = args[start];
	final int equalsPosition = arg.indexOf('=');

	if (arg.startsWith(optionPrefix) && equalsPosition > optionPrefixLength) {
		final String propertyName = arg.substring(optionPrefixLength,
				equalsPosition);

		final String value = arg.substring(equalsPosition + 1);
		consumed++;
		try {
			BeanUtils.setProperty(this, propertyName, value);
		} catch (Exception ex) {
			ex.printStackTrace();
			throw new BadCommandLineException("Error setting property ["
					+ propertyName + "], value [" + value + "].");
		}
	}
	return consumed;
}
 
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:30,代码来源:AbstractParameterizablePlugin.java

示例9: createModel

import com.sun.tools.xjc.BadCommandLineException; //导入依赖的package包/类
@BeforeClass
public static void createModel() throws BadCommandLineException,
		IOException {
	final String generateDirectory = "target/generated-sources/"
			+ AlphaMInfoFactoryTest.class.getPackage().getName();
	new File(generateDirectory).mkdirs();
	final URL schema = AlphaMInfoFactoryTest.class
			.getResource("schema.xsd");
	final URL binding = AlphaMInfoFactoryTest.class
			.getResource("binding.xjb");
	final String[] arguments = new String[] { "-xmlschema",
			schema.toExternalForm(), "-b", binding.toExternalForm(), "-d",
			generateDirectory, "-extension" };

	Options options = new Options();
	options.parseArguments(arguments);
	ConsoleErrorReporter receiver = new ConsoleErrorReporter();
	Model model = ModelLoader.load(options, new JCodeModel(), receiver);
	Assert.assertNotNull(model);

	final XJCCMInfoFactory factory = new XJCCMInfoFactory(model);

	AlphaMInfoFactoryTest.MODEL_INFO = factory.createModel();

	model.generateCode(options, receiver);
	com.sun.codemodel.CodeWriter cw = options.createCodeWriter();
	model.codeModel.build(cw);

}
 
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:30,代码来源:AlphaMInfoFactoryTest.java

示例10: createOptions

import com.sun.tools.xjc.BadCommandLineException; //导入依赖的package包/类
public Options createOptions() throws IOException, BadCommandLineException {
	final Options options = new Options();
	options.targetDir = targetDirectory;
	options.verbose = true;
	options.debugMode = false;
	options.setSchemaLanguage(Language.XMLSCHEMA);
	options.strictCheck = false;
	options.readOnly = false;
	options.compatibilityMode = Options.EXTENSION;
	// options.set

	if (schemas != null) {
		for (final File schema : schemas) {
			options.addGrammar(schema);
		}
	}

	if (bindings != null) {
		for (File binding : bindings) {
			options.addBindFile(binding);
		}
	}

	if (catalog != null) {
		options.addCatalog(catalog);
	}
	options.parseArguments(getArguments());
	return options;
}
 
开发者ID:highsource,项目名称:hyperjaxb3,代码行数:30,代码来源:DynamicCompiler.java

示例11: execute

import com.sun.tools.xjc.BadCommandLineException; //导入依赖的package包/类
public void execute() throws IOException, BadCommandLineException {

		final Options options = createOptions();
		final JCodeModel codeModel = createCodeModel();
		final CodeWriter codeWriter = createCodeWriter();
		final ErrorReceiver errorReceiver = createErrorReceiver();
		execute(options, codeModel, codeWriter, errorReceiver);

	}
 
开发者ID:highsource,项目名称:hyperjaxb3,代码行数:10,代码来源:DynamicCompiler.java

示例12: scanEpisodeFile

import com.sun.tools.xjc.BadCommandLineException; //导入依赖的package包/类
private static void scanEpisodeFile(File jar, SchemaCompiler sc)
        throws BadCommandLineException, IOException {

    URLClassLoader ucl = new URLClassLoader(new URL[]{jar.toURL()});
    Enumeration<URL> resources = ucl.findResources("META-INF/sun-jaxb.episode");
    while (resources.hasMoreElements()) {
        URL url = resources.nextElement();
        sc.getOptions().addBindFile(new InputSource(url.toExternalForm()));
    }

}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:12,代码来源:CodeGenerationUtility.java

示例13: parseArgument

import com.sun.tools.xjc.BadCommandLineException; //导入依赖的package包/类
@Override
public int parseArgument(Options opt, String[] args, int i)
		throws BadCommandLineException, IOException {

	final PartialCmdLineParser cmdLineParser = new PartialCmdLineParser(
			getSettings());
	try {
		return cmdLineParser.parseArgument(args, i);
	} catch (CmdLineException clex) {
		throw new BadCommandLineException("Error parsing arguments.", clex);
	}
}
 
开发者ID:highsource,项目名称:jsonix-schema-compiler,代码行数:13,代码来源:JsonixPlugin.java

示例14: onActivated

import com.sun.tools.xjc.BadCommandLineException; //导入依赖的package包/类
@Override
public void onActivated(Options opts) throws BadCommandLineException {
	final ILoggerFactory iLoggerFactory = LoggerFactory.getILoggerFactory();
	if (iLoggerFactory instanceof NOPLoggerFactory) {
		System.err
				.println("You seem to be using the NOP provider of the SLF4j logging facade. "
						+ "With this configuration, log messages will be completely suppressed. "
						+ "Please consider adding a SLF4j provider (for instance slf4j-simple) to enable logging.");
	}
}
 
开发者ID:highsource,项目名称:jsonix-schema-compiler,代码行数:11,代码来源:JsonixPlugin.java

示例15: _main

import com.sun.tools.xjc.BadCommandLineException; //导入依赖的package包/类
private static void _main( String[] args ) throws Exception {
    try {
        System.exit(run( args, System.out, System.out ));
    } catch (BadCommandLineException e) {
        // there was an error in the command line.
        // print usage and abort.
        if(e.getMessage()!=null) {
            System.out.println(e.getMessage());
            System.out.println();
        }

        usage(e.getOptions(),false);
        System.exit(-1);
    }
}
 
开发者ID:bulldog2011,项目名称:mxjc,代码行数:16,代码来源:Driver.java


注:本文中的com.sun.tools.xjc.BadCommandLineException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。