com.sun.tools.xjc.Language Java Examples

The following examples show how to use com.sun.tools.xjc.Language. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OptionsFactory.java    From maven-jaxb2-plugin with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private Language createLanguage(String schemaLanguage)
		throws MojoExecutionException {
	if (StringUtils.isEmpty(schemaLanguage)) {
		return null;
	} else if ("AUTODETECT".equalsIgnoreCase(schemaLanguage))
		return null; // nothing, it is AUTDETECT by default.
	else if ("XMLSCHEMA".equalsIgnoreCase(schemaLanguage))
		return Language.XMLSCHEMA;
	else if ("DTD".equalsIgnoreCase(schemaLanguage))
		return Language.DTD;
	else if ("RELAXNG".equalsIgnoreCase(schemaLanguage))
		return Language.RELAXNG;
	else if ("RELAXNG_COMPACT".equalsIgnoreCase(schemaLanguage))
		return Language.RELAXNG_COMPACT;
	else if ("WSDL".equalsIgnoreCase(schemaLanguage))
		return Language.WSDL;
	else {
		throw new MojoExecutionException(MessageFormat.format(
				"Unknown schemaLanguage [{0}].", schemaLanguage));
	}
}
 
Example #2
Source File: OptionsFactory.java    From maven-jaxb2-plugin with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private Language createLanguage(String schemaLanguage)
		throws MojoExecutionException {
	if (StringUtils.isEmpty(schemaLanguage)) {
		return null;
	} else if ("AUTODETECT".equalsIgnoreCase(schemaLanguage))
		return null; // nothing, it is AUTDETECT by default.
	else if ("XMLSCHEMA".equalsIgnoreCase(schemaLanguage))
		return Language.XMLSCHEMA;
	else if ("DTD".equalsIgnoreCase(schemaLanguage))
		return Language.DTD;
	else if ("WSDL".equalsIgnoreCase(schemaLanguage))
		return Language.WSDL;
	else {
		throw new MojoExecutionException(MessageFormat.format(
				"Unknown schemaLanguage [{0}].", schemaLanguage));
	}
}
 
Example #3
Source File: OptionsFactory.java    From maven-jaxb2-plugin with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private Language createLanguage(String schemaLanguage)
		throws MojoExecutionException {
	if (StringUtils.isEmpty(schemaLanguage)) {
		return null;
	} else if ("AUTODETECT".equalsIgnoreCase(schemaLanguage))
		return null; // nothing, it is AUTDETECT by default.
	else if ("XMLSCHEMA".equalsIgnoreCase(schemaLanguage))
		return Language.XMLSCHEMA;
	else if ("DTD".equalsIgnoreCase(schemaLanguage))
		return Language.DTD;
	else if ("WSDL".equalsIgnoreCase(schemaLanguage))
		return Language.WSDL;
	else {
		throw new MojoExecutionException("Unknown schemaLanguage ["
				+ schemaLanguage + "].");
	}
}
 
Example #4
Source File: OptionsFactory.java    From maven-jaxb2-plugin with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private Language createLanguage(String schemaLanguage)
		throws MojoExecutionException {
	if (StringUtils.isEmpty(schemaLanguage)) {
		return null;
	} else if ("AUTODETECT".equalsIgnoreCase(schemaLanguage))
		return null; // nothing, it is AUTDETECT by default.
	else if ("XMLSCHEMA".equalsIgnoreCase(schemaLanguage))
		return Language.XMLSCHEMA;
	else if ("DTD".equalsIgnoreCase(schemaLanguage))
		return Language.DTD;
	else if ("WSDL".equalsIgnoreCase(schemaLanguage))
		return Language.WSDL;
	else {
		throw new MojoExecutionException("Unknown schemaLanguage ["
				+ schemaLanguage + "].");
	}
}
 
Example #5
Source File: OptionsFactory.java    From maven-jaxb2-plugin with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private Language createLanguage(String schemaLanguage)
		throws MojoExecutionException {
	if (StringUtils.isEmpty(schemaLanguage)) {
		return null;
	} else if ("AUTODETECT".equalsIgnoreCase(schemaLanguage))
		return null; // nothing, it is AUTDETECT by default.
	else if ("XMLSCHEMA".equalsIgnoreCase(schemaLanguage))
		return Language.XMLSCHEMA;
	else if ("DTD".equalsIgnoreCase(schemaLanguage))
		return Language.DTD;
	else if ("RELAXNG".equalsIgnoreCase(schemaLanguage))
		return Language.RELAXNG;
	else if ("RELAXNG_COMPACT".equalsIgnoreCase(schemaLanguage))
		return Language.RELAXNG_COMPACT;
	else if ("WSDL".equalsIgnoreCase(schemaLanguage))
		return Language.WSDL;
	else {
		throw new MojoExecutionException(MessageFormat.format(
				"Unknown schemaLanguage [{0}].", schemaLanguage));
	}
}
 
Example #6
Source File: GenerateWithJaxbApi.java    From java-9-wtf with Apache License 2.0 5 votes vote down vote up
private Options createOptions(String configuration) throws IOException {
	Options options = new Options();

	options.compatibilityMode = 2;
	options.disableXmlSecurity = true;
	options.entityResolver = EntityResolverFactory.create(configuration);
	generateSchemaInputSources().forEach(options::addGrammar);
	options.setSchemaLanguage(Language.XMLSCHEMA);
	options.target = SpecVersion.V2_2;
	options.targetDir = createCleanTargetDirectory();

	return options;
}
 
Example #7
Source File: DynamicCompiler.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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;
}
 
Example #8
Source File: MXJC2Task.java    From mxjc with MIT License 5 votes vote down vote up
/**
 * Sets the schema language.
 */
public void setLanguage(String language) {
    Language l = Language.valueOf(language.toUpperCase());
    if(l==null) {
        Language[] languages = Language.values();
        String[] candidates = new String[languages.length];
        for( int i=0; i<candidates.length; i++ )
            candidates[i] = languages[i].name();

        throw new BuildException("Unrecognized language: "+language+". Did you mean "+
        EditDistance.findNearest(language.toUpperCase(),candidates)+" ?");
    }
    options.setSchemaLanguage(l);
}
 
Example #9
Source File: MXJC2Task.java    From mxjc with MIT License 4 votes vote down vote up
public MXJC2Task() {
    super();
    classpath = new Path(null);
    options.setSchemaLanguage(Language.XMLSCHEMA);  // disable auto-guessing
}