本文整理汇总了Java中com.sun.tools.xjc.ModelLoader类的典型用法代码示例。如果您正苦于以下问题:Java ModelLoader类的具体用法?Java ModelLoader怎么用?Java ModelLoader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModelLoader类属于com.sun.tools.xjc包,在下文中一共展示了ModelLoader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: compilesSchema
import com.sun.tools.xjc.ModelLoader; //导入依赖的package包/类
@Test
public void compilesSchema() throws Exception {
new File("target/generated-sources/xjc").mkdirs();
URL schema = getClass().getResource("/schema.xsd");
URL binding = getClass().getResource("/binding.xjb");
final String[] arguments = new String[] { "-xmlschema",
schema.toExternalForm(), "-b", binding.toExternalForm(), "-d",
"target/generated-sources/xjc", "-extension", "-XhashCode",
"-Xequals", "-XtoString", "-Xcopyable", "-Xmergeable",
"-Xinheritance", "-Xsetters", "-Xsetters-mode=direct",
"-Xwildcard", "-XenumValue"
// "-XsimpleToString"
};
Options options = new Options();
options.parseArguments(arguments);
ConsoleErrorReporter receiver = new ConsoleErrorReporter();
Model model = ModelLoader.load(options, new JCodeModel(), receiver);
model.generateCode(options, receiver);
com.sun.codemodel.CodeWriter cw = options.createCodeWriter();
model.codeModel.build(cw);
}
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:26,代码来源:RunPlugins.java
示例2: compilesCustomer
import com.sun.tools.xjc.ModelLoader; //导入依赖的package包/类
@Test
public void compilesCustomer() throws Exception {
new File("target/generated-sources/xjc").mkdirs();
URL schema = getClass().getResource("/customer.xsd");
URL binding = getClass().getResource("/customer.xjb");
final String[] arguments = new String[] { "-xmlschema",
schema.toExternalForm(), "-b", binding.toExternalForm(), "-d",
"target/generated-sources/xjc", "-extension",
"-XsimpleHashCode",
// "-XsimpleEquals", "-XsimpleToString"
};
Options options = new Options();
options.parseArguments(arguments);
ConsoleErrorReporter receiver = new ConsoleErrorReporter();
Model model = ModelLoader.load(options, new JCodeModel(), receiver);
model.generateCode(options, receiver);
com.sun.codemodel.CodeWriter cw = options.createCodeWriter();
model.codeModel.build(cw);
}
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:23,代码来源:RunPluginsForCustomer.java
示例3: compilesSchema
import com.sun.tools.xjc.ModelLoader; //导入依赖的package包/类
@Test
public void compilesSchema() throws Exception {
new File("target/generated-sources/xjc").mkdirs();
URL schema = getClass().getResource("/main.xsd");
URL binding = getClass().getResource("/main.xjb");
final String[] arguments = new String[] { "-xmlschema",
schema.toExternalForm(), "-b", binding.toExternalForm(), "-d",
"target/generated-sources/xjc", "-extension",
"-XsimpleHashCode",
// "-XsimpleEquals", "-XsimpleToString"
};
Options options = new Options();
options.parseArguments(arguments);
ConsoleErrorReporter receiver = new ConsoleErrorReporter();
Model model = ModelLoader.load(options, new JCodeModel(), receiver);
model.generateCode(options, receiver);
com.sun.codemodel.CodeWriter cw = options.createCodeWriter();
model.codeModel.build(cw);
}
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:23,代码来源:RunPluginsForMain.java
示例4: compilesSchema
import com.sun.tools.xjc.ModelLoader; //导入依赖的package包/类
@Test
public void compilesSchema() throws Exception {
new File("target/generated-sources/xjc").mkdirs();
URL schema = getClass().getResource("/cases.xsd");
// URL binding = getClass().getResource("/cases.xjb");
final String[] arguments = new String[] { "-xmlschema",
schema.toExternalForm(),
// "-b", binding.toExternalForm(),
"-d", "target/generated-sources/xjc", "-extension",
"-XsimpleHashCode", "-XsimpleEquals",
// "-XsimpleToString"
};
Options options = new Options();
options.parseArguments(arguments);
ConsoleErrorReporter receiver = new ConsoleErrorReporter();
Model model = ModelLoader.load(options, new JCodeModel(), receiver);
model.generateCode(options, receiver);
com.sun.codemodel.CodeWriter cw = options.createCodeWriter();
model.codeModel.build(cw);
}
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:25,代码来源:RunPluginsForCases.java
示例5: compilesSchema
import com.sun.tools.xjc.ModelLoader; //导入依赖的package包/类
@Test
public void compilesSchema() throws Exception {
new File("target/generated-sources/xjc").mkdirs();
URL schema = getClass().getResource("/schema.xsd");
URL binding = getClass().getResource("/binding.xjb");
final String[] arguments = new String[] { "-xmlschema",
schema.toExternalForm(), "-b", binding.toExternalForm(), "-d",
"target/generated-sources/xjc", "-extension", "-Xsimplify", "-Xsimplify-usePluralForm=true"};
Options options = new Options();
options.parseArguments(arguments);
ConsoleErrorReporter receiver = new ConsoleErrorReporter();
Model model = ModelLoader.load(options, new JCodeModel(), receiver);
model.generateCode(options, receiver);
com.sun.codemodel.CodeWriter cw = options.createCodeWriter();
model.codeModel.build(cw);
}
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:20,代码来源:RunSimplifyPlugin.java
示例6: compilesContext_V_1_1_0
import com.sun.tools.xjc.ModelLoader; //导入依赖的package包/类
@Test
public void compilesContext_V_1_1_0() throws Exception {
new File("target/generated-sources/xjc").mkdirs();
final String[] arguments = new String[] { "-xmlschema",
new File("src/main/resources/schema.xsd").toURI().toString(),
"-d",
"target/generated-sources/xjc",
"-XfixJAXB1058",
"-extension", "-XtoString",
"-Xequals", "-XhashCode", "-Xcopyable", "-Xmergeable"};
Options options = new Options();
options.parseArguments(arguments);
ConsoleErrorReporter receiver = new ConsoleErrorReporter();
Model model = ModelLoader.load(options, new JCodeModel(), receiver);
model.generateCode(options, receiver);
com.sun.codemodel.CodeWriter cw = options.createCodeWriter();
model.codeModel.build(cw);
}
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:22,代码来源:ExecuteJAXB1058.java
示例7: compilesSchema
import com.sun.tools.xjc.ModelLoader; //导入依赖的package包/类
@Test
public void compilesSchema() throws Exception {
new File("target/generated-sources/xjc").mkdirs();
URL schema = getClass().getResource("/schema.xsd");
URL binding = getClass().getResource("/bindings.xjb");
final String[] arguments = new String[] { "-xmlschema",
schema.toExternalForm(), "-b", binding.toExternalForm(), "-d",
"target/generated-sources/xjc", "-extension", "-Xsimplify", "-Xsimplify-usePluralForm=true"};
Options options = new Options();
options.parseArguments(arguments);
ConsoleErrorReporter receiver = new ConsoleErrorReporter();
Model model = ModelLoader.load(options, new JCodeModel(), receiver);
model.generateCode(options, receiver);
com.sun.codemodel.CodeWriter cw = options.createCodeWriter();
model.codeModel.build(cw);
}
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:20,代码来源:RunSimplifyPlugin.java
示例8: compilesSchema
import com.sun.tools.xjc.ModelLoader; //导入依赖的package包/类
@Test
public void compilesSchema() throws Exception {
new File("target/generated-sources/xjc").mkdirs();
URL schema = getClass().getResource("/schema.xsd");
URL binding = getClass().getResource("/binding.xjb");
final String[] arguments = new String[] { "-xmlschema",
schema.toExternalForm(), "-b", binding.toExternalForm(), "-d",
"target/generated-sources/xjc", "-extension", "-XtoString",
"-Xequals", "-XhashCode", "-Xcopyable", "-Xmergeable" };
Options options = new Options();
options.parseArguments(arguments);
ConsoleErrorReporter receiver = new ConsoleErrorReporter();
Model model = ModelLoader.load(options, new JCodeModel(), receiver);
model.generateCode(options, receiver);
com.sun.codemodel.CodeWriter cw = options.createCodeWriter();
model.codeModel.build(cw);
}
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:21,代码来源:RunPlugins.java
示例9: compilesIssues
import com.sun.tools.xjc.ModelLoader; //导入依赖的package包/类
@Test
public void compilesIssues() throws Exception {
new File("target/generated-sources/xjc").mkdirs();
URL schema = getClass().getResource("/schema.xsd");
URL binding = getClass().getResource("/binding.xjb");
final String[] arguments = new String[] {
"-xmlschema", schema.toExternalForm(),
"-b", binding.toExternalForm(),
"-d", "target/generated-sources/xjc",
"-extension",
"-Xjsonix",
"-Xjsonix-generateJsonSchema"
};
Options options = new Options();
options.parseArguments(arguments);
ConsoleErrorReporter receiver = new ConsoleErrorReporter();
Model model = ModelLoader.load(options, new JCodeModel(), receiver);
model.generateCode(options, receiver);
com.sun.codemodel.CodeWriter cw = options.createCodeWriter();
model.codeModel.build(cw);
}
开发者ID:highsource,项目名称:jsonix-schema-compiler,代码行数:27,代码来源:CompileIssues.java
示例10: compilesBasicZero
import com.sun.tools.xjc.ModelLoader; //导入依赖的package包/类
@Test
public void compilesBasicZero() throws Exception {
new File("target/generated-sources/basic/zero").mkdirs();
final String[] arguments = new String[] {
"-xmlschema",
getClass().getResource("/basic/zero/schema.xsd")
.toExternalForm(), "-d",
"target/generated-sources/basic/zero", "-extension", "-Xjsonix", "-Xjsonix-generateJsonSchema"
};
Options options = new Options();
options.parseArguments(arguments);
ConsoleErrorReporter receiver = new ConsoleErrorReporter();
Model model = ModelLoader.load(options, new JCodeModel(), receiver);
model.generateCode(options, receiver);
com.sun.codemodel.CodeWriter cw = options.createCodeWriter();
model.codeModel.build(cw);
}
开发者ID:highsource,项目名称:jsonix-schema-compiler,代码行数:22,代码来源:JsonixPluginZeroTest.java
示例11: compilesOWS_V_1_1_0
import com.sun.tools.xjc.ModelLoader; //导入依赖的package包/类
@Test
public void compilesOWS_V_1_1_0() throws Exception {
new File("target/generated-sources/ows-v_1_1_0").mkdirs();
URL schema = getClass().getResource("/ogc/ows/1.1.0/owsAll.xsd");
URL binding = getClass().getResource("/ogc/ows-v_1_1_0.xjb");
final String[] arguments = new String[] { "-xmlschema",
schema.toExternalForm(), "-b", binding.toExternalForm(), "-d",
"target/generated-sources/ows-v_1_1_0", "-extension",
"-Xjsonix"
};
Options options = new Options();
options.parseArguments(arguments);
ConsoleErrorReporter receiver = new ConsoleErrorReporter();
Model model = ModelLoader.load(options, new JCodeModel(), receiver);
model.generateCode(options, receiver);
com.sun.codemodel.CodeWriter cw = options.createCodeWriter();
model.codeModel.build(cw);
}
开发者ID:highsource,项目名称:jsonix-schema-compiler,代码行数:23,代码来源:JsonixPluginTest.java
示例12: compilesWFS_V_2_0
import com.sun.tools.xjc.ModelLoader; //导入依赖的package包/类
@Test
public void compilesWFS_V_2_0() throws Exception {
new File("target/generated-sources/wfs-v_2_0").mkdirs();
URL schema = getClass().getResource("/ogc/wfs/2.0/wfs.xsd");
URL binding = getClass().getResource("/ogc/wfs-v_2_0.xjb");
final String[] arguments = new String[] { "-xmlschema",
schema.toExternalForm(), "-b", binding.toExternalForm(), "-d",
"target/generated-sources/wfs-v_2_0", "-extension", "-Xjsonix"
};
Options options = new Options();
options.parseArguments(arguments);
ConsoleErrorReporter receiver = new ConsoleErrorReporter();
Model model = ModelLoader.load(options, new JCodeModel(), receiver);
model.generateCode(options, receiver);
com.sun.codemodel.CodeWriter cw = options.createCodeWriter();
model.codeModel.build(cw);
}
开发者ID:highsource,项目名称:jsonix-schema-compiler,代码行数:22,代码来源:JsonixPluginTest.java
示例13: compilesContext_V_1_1_0
import com.sun.tools.xjc.ModelLoader; //导入依赖的package包/类
@Test
public void compilesContext_V_1_1_0() throws Exception {
new File("target/generated-sources/context-v_1_1_0").mkdirs();
final String[] arguments = new String[] {
"-xmlschema",
getClass().getResource("/ogc/context/1.1.0/wmcAll.xsd")
.toExternalForm(),
"-b",
getClass().getResource("/ogc/context-v_1_1_0.xjb")
.toExternalForm(), "-d",
"target/generated-sources/context-v_1_1_0", "-extension",
"-Xjsonix"
};
Options options = new Options();
options.parseArguments(arguments);
ConsoleErrorReporter receiver = new ConsoleErrorReporter();
Model model = ModelLoader.load(options, new JCodeModel(), receiver);
model.generateCode(options, receiver);
com.sun.codemodel.CodeWriter cw = options.createCodeWriter();
model.codeModel.build(cw);
}
开发者ID:highsource,项目名称:jsonix-schema-compiler,代码行数:26,代码来源:JsonixPluginTest.java
示例14: loadModel
import com.sun.tools.xjc.ModelLoader; //导入依赖的package包/类
public MModelInfo<NType, NClass> loadModel(String resource)
throws Exception {
System.setProperty("javax.xml.accessExternalSchema", "all");
new File("target/generated-sources/" + resource).mkdirs();
final String[] arguments = new String[] { "-xmlschema",
getClass().getResource("/" + resource).toExternalForm(), "-d",
"target/generated-sources/" + resource, "-extension",
"-Xjsonix", "-Xjsonix-generateJsonSchema" };
Options options = new Options();
options.parseArguments(arguments);
ConsoleErrorReporter receiver = new ConsoleErrorReporter();
Model model = ModelLoader.load(options, new JCodeModel(), receiver);
model.generateCode(options, receiver);
com.sun.codemodel.CodeWriter cw = options.createCodeWriter();
model.codeModel.build(cw);
final MModelInfo<NType, NClass> modelInfo = new XJCCMInfoFactory(model)
.createModel();
return modelInfo;
}
开发者ID:highsource,项目名称:jsonix-schema-compiler,代码行数:24,代码来源:MModelInfoLoader.java
示例15: compilesSchema
import com.sun.tools.xjc.ModelLoader; //导入依赖的package包/类
@Test
public void compilesSchema() throws Exception {
new File("target/generated-sources/xjc").mkdirs();
String schemaDirectory = new File(getClass().getResource("/schema.xsd")
.toURI()).getParentFile().getAbsolutePath();
String bindingDirectory = new File(getClass().getResource(
"/binding.xjb").toURI()).getParentFile().getAbsolutePath();
final String[] arguments = new String[] { "-xmlschema",
schemaDirectory, "-b", bindingDirectory, "-d",
"target/generated-sources/xjc", "-extension", "-Xannotate"
};
Options options = new Options();
options.parseArguments(arguments);
ConsoleErrorReporter receiver = new ConsoleErrorReporter();
Model model = ModelLoader.load(options, new JCodeModel(), receiver);
model.generateCode(options, receiver);
com.sun.codemodel.CodeWriter cw = options.createCodeWriter();
model.codeModel.build(cw);
}
开发者ID:highsource,项目名称:jaxb2-annotate-plugin,代码行数:24,代码来源:RunPlugins.java
示例16: createModel
import com.sun.tools.xjc.ModelLoader; //导入依赖的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
示例17: loadModel
import com.sun.tools.xjc.ModelLoader; //导入依赖的package包/类
protected Model loadModel(Options options) throws MojoExecutionException {
if (getVerbose()) {
getLog().info("Parsing input schema(s)...");
}
final Model model = ModelLoader.load(options, new JCodeModel(),
new LoggingErrorReceiver("Error while parsing schema(s).",
getLog(), getVerbose()));
if (model == null)
throw new MojoExecutionException(
"Unable to parse input schema(s). Error messages should have been provided.");
return model;
}
开发者ID:highsource,项目名称:maven-jaxb2-plugin,代码行数:14,代码来源:XJC21Mojo.java
示例18: execute
import com.sun.tools.xjc.ModelLoader; //导入依赖的package包/类
private void execute(String configuration) throws Exception {
Options options = createOptions(configuration);
Model model = ModelLoader.load(options, new JCodeModel(), ERROR_RECEIVER);
Outline outline = model.generateCode(model.options, ERROR_RECEIVER);
writeCode(outline);
}
开发者ID:CodeFX-org,项目名称:java-9-wtf,代码行数:7,代码来源:GenerateWithJaxbApi.java
示例19: bind
import com.sun.tools.xjc.ModelLoader; //导入依赖的package包/类
public JAXBModelImpl bind() {
// this has been problematic. turn it off.
// if(!forest.checkSchemaCorrectness(this))
// return null;
// parse all the binding files given via XJC -b options.
// this also takes care of the binding files given in the -episode option.
for (InputSource is : opts.getBindFiles())
parseSchema(is);
// internalization
SCDBasedBindingSet scdBasedBindingSet = forest.transform(opts.isExtensionMode());
if(!NO_CORRECTNESS_CHECK) {
// correctness check
SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
sf.setErrorHandler(new DowngradingErrorHandler(this));
forest.weakSchemaCorrectnessCheck(sf);
if(hadError)
return null; // error in the correctness check. abort now
}
JCodeModel codeModel = new JCodeModel();
ModelLoader gl = new ModelLoader(opts,codeModel,this);
try {
XSSchemaSet result = gl.createXSOM(forest, scdBasedBindingSet);
if(result==null)
return null;
// we need info about each field, so we go ahead and generate the
// skeleton at this point.
// REVISIT: we should separate FieldRenderer and FieldAccessor
// so that accessors can be used before we build the code.
Model model = gl.annotateXMLSchema(result);
if(model==null) return null;
if(hadError) return null; // if we have any error by now, abort
context = model.generateCode(opts,this);
if(context==null) return null;
if(hadError) return null;
return new JAXBModelImpl(context);
} catch( SAXException e ) {
// since XSOM uses our parser that scans DOM,
// no parser error is possible.
// all the other errors will be directed to ErrorReceiver
// before it's thrown, so when the exception is thrown
// the error should have already been reported.
// thus ignore.
return null;
}
}
开发者ID:maxep,项目名称:max-ws,代码行数:59,代码来源:SchemaCompilerEx.java
示例20: compilesSchema
import com.sun.tools.xjc.ModelLoader; //导入依赖的package包/类
@Test
public void compilesSchema() throws Exception {
new File("target/generated-sources/xjc").mkdirs();
URL schema = getClass().getResource("/schema.xsd");
URL binding = getClass().getResource("/binding.xjb");
final String[] arguments = new String[] { "-xmlschema",
schema.toExternalForm(), "-b", binding.toExternalForm(), "-d",
"target/generated-sources/xjc", "-extension", "-XhashCode",
"-Xequals", "-XtoString", "-Xcopyable", "-Xmergeable",
"-Xinheritance", "-Xsetters", "-Xsetters-mode=direct",
"-Xwildcard", "-XenumValue"
// "-XsimpleToString"
};
Options options = new Options();
options.parseArguments(arguments);
ConsoleErrorReporter receiver = new ConsoleErrorReporter();
Model model = ModelLoader.load(options, new JCodeModel(), receiver);
final XJCCMInfoFactory factory = new XJCCMInfoFactory(model);
final MModelInfo<NType, NClass> mmodel = factory.createModel();
final MClassInfo<NType, NClass> classInfo = mmodel
.getClassInfo("org.jvnet.jaxb2_commons.tests.issues.IssueGH26Type");
Assert.assertNotNull(classInfo);
final MElementPropertyInfo<NType, NClass> a = (MElementPropertyInfo<NType, NClass>) classInfo
.getProperty("a");
Assert.assertEquals("a", a.getDefaultValue());
Assert.assertNotNull(a.getDefaultValueNamespaceContext());
final MElementsPropertyInfo<NType, NClass> bOrC = (MElementsPropertyInfo<NType, NClass>) classInfo
.getProperty("bOrC");
// Assert.assertEquals("b", bOrC.getElementTypeInfos().get(0).getDefaultValue());
Assert.assertNotNull(bOrC.getElementTypeInfos().get(0).getDefaultValueNamespaceContext());
// Assert.assertEquals("3", bOrC.getElementTypeInfos().get(1).getDefaultValue());
Assert.assertNotNull(bOrC.getElementTypeInfos().get(1).getDefaultValueNamespaceContext());
final MElementRefsPropertyInfo<NType, NClass> dOrE = (MElementRefsPropertyInfo<NType, NClass>) classInfo
.getProperty("dOrE");
// Assert.assertEquals("e", dOrE.getElementTypeInfos().get(0).getDefaultValue());
Assert.assertNotNull(dOrE.getElementTypeInfos().get(0).getDefaultValueNamespaceContext());
// Assert.assertEquals("d", dOrE.getElementTypeInfos().get(1).getDefaultValue());
Assert.assertNotNull(dOrE.getElementTypeInfos().get(1).getDefaultValueNamespaceContext());
final MAttributePropertyInfo<NType, NClass> z = (MAttributePropertyInfo<NType, NClass>) classInfo
.getProperty("z");
Assert.assertEquals("z", z.getDefaultValue());
Assert.assertNotNull(z.getDefaultValueNamespaceContext());
// model.generateCode(options, receiver);
// com.sun.codemodel.CodeWriter cw = options.createCodeWriter();
// model.codeModel.build(cw);
}
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:58,代码来源:GH26Test.java
注:本文中的com.sun.tools.xjc.ModelLoader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论