本文整理汇总了Java中com.sun.tools.internal.xjc.util.ErrorReceiverFilter类的典型用法代码示例。如果您正苦于以下问题:Java ErrorReceiverFilter类的具体用法?Java ErrorReceiverFilter怎么用?Java ErrorReceiverFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ErrorReceiverFilter类属于com.sun.tools.internal.xjc.util包,在下文中一共展示了ErrorReceiverFilter类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: build
import com.sun.tools.internal.xjc.util.ErrorReceiverFilter; //导入依赖的package包/类
/**
* Entry point.
*/
public static Model build( XSSchemaSet _schemas, JCodeModel codeModel,
ErrorReceiver _errorReceiver, Options opts ) {
// set up a ring
final Ring old = Ring.begin();
try {
ErrorReceiverFilter ef = new ErrorReceiverFilter(_errorReceiver);
Ring.add(XSSchemaSet.class,_schemas);
Ring.add(codeModel);
Model model = new Model(opts, codeModel, null/*set later*/, opts.classNameAllocator, _schemas);
Ring.add(model);
Ring.add(ErrorReceiver.class,ef);
Ring.add(CodeModelClassFactory.class,new CodeModelClassFactory(ef));
BGMBuilder builder = new BGMBuilder(opts.defaultPackage,opts.defaultPackage2,
opts.isExtensionMode(),opts.getFieldRendererFactory(), opts.activePlugins);
builder._build();
if(ef.hadError()) return null;
else return model;
} finally {
Ring.end(old);
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:BGMBuilder.java
示例2: checkSchemaCorrectness
import com.sun.tools.internal.xjc.util.ErrorReceiverFilter; //导入依赖的package包/类
/**
* Checks the correctness of the XML Schema documents and return true
* if it's OK.
*
* <p>
* This method performs a weaker version of the tests where error messages
* are provided without line number information. So whenever possible
* use {@link SchemaConstraintChecker}.
*
* @see SchemaConstraintChecker
*/
public boolean checkSchemaCorrectness(ErrorReceiver errorHandler) {
try {
boolean disableXmlSecurity = false;
if (options != null) {
disableXmlSecurity = options.disableXmlSecurity;
}
SchemaFactory sf = XmlFactory.createSchemaFactory(W3C_XML_SCHEMA_NS_URI, disableXmlSecurity);
ErrorReceiverFilter filter = new ErrorReceiverFilter(errorHandler);
sf.setErrorHandler(filter);
Set<String> roots = getRootDocuments();
Source[] sources = new Source[roots.size()];
int i=0;
for (String root : roots) {
sources[i++] = new DOMSource(get(root),root);
}
sf.newSchema(sources);
return !filter.hadError();
} catch (SAXException e) {
// the errors should have been reported
return false;
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:DOMForest.java
示例3: checkSchemaCorrectness
import com.sun.tools.internal.xjc.util.ErrorReceiverFilter; //导入依赖的package包/类
/**
* Checks the correctness of the XML Schema documents and return true
* if it's OK.
*
* <p>
* This method performs a weaker version of the tests where error messages
* are provided without line number information. So whenever possible
* use {@link SchemaConstraintChecker}.
*
* @see SchemaConstraintChecker
*/
public boolean checkSchemaCorrectness(ErrorReceiver errorHandler) {
try {
SchemaFactory sf = SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
ErrorReceiverFilter filter = new ErrorReceiverFilter(errorHandler);
sf.setErrorHandler(filter);
Set<String> roots = getRootDocuments();
Source[] sources = new Source[roots.size()];
int i=0;
for (String root : roots) {
sources[i++] = new DOMSource(get(root),root);
}
sf.newSchema(sources);
return !filter.hadError();
} catch (SAXException e) {
// the errors should have been reported
return false;
}
}
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:30,代码来源:DOMForest.java
示例4: TDTDReader
import com.sun.tools.internal.xjc.util.ErrorReceiverFilter; //导入依赖的package包/类
protected TDTDReader(ErrorReceiver errorReceiver, Options opts, InputSource _bindInfo)
throws AbortException {
this.entityResolver = opts.entityResolver;
this.errorReceiver = new ErrorReceiverFilter(errorReceiver);
bindInfo = new BindInfo(model,_bindInfo, this.errorReceiver);
classFactory = new CodeModelClassFactory(errorReceiver);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:TDTDReader.java
示例5: generateCode
import com.sun.tools.internal.xjc.util.ErrorReceiverFilter; //导入依赖的package包/类
/**
* Fully-generate the source code into the given model.
*
* @return
* null if there was any errors. Otherwise it returns a valid
* {@link Outline} object, which captures how the model objects
* are mapped to the generated source code.
* <p>
* Add-ons can use those information to further augment the generated
* source code.
*/
public Outline generateCode(Options opt,ErrorReceiver receiver) {
ErrorReceiverFilter ehf = new ErrorReceiverFilter(receiver);
// run extensions // moved to BGMBuilder._build() - issue with hyperjaxb3
// for( Plugin ma : opt.activePlugins )
// ma.postProcessModel(this,ehf);
Outline o = BeanGenerator.generate(this, ehf);
try {// run extensions
for( Plugin ma : opt.activePlugins )
ma.run(o,opt,ehf);
} catch (SAXException e) {
// fatal error. error should have been reported
return null;
}
// check for unused plug-in customizations.
// these can be only checked after the plug-ins run, so it's here.
// the JAXB bindings are checked by XMLSchema's builder.
Set<CCustomizations> check = new HashSet<CCustomizations>();
for( CCustomizations c=customizations; c!=null; c=c.next ) {
if(!check.add(c)) {
throw new AssertionError(); // detect a loop
}
for (CPluginCustomization p : c) {
if(!p.isAcknowledged()) {
ehf.error(
p.locator,
Messages.format(
Messages.ERR_UNACKNOWLEDGED_CUSTOMIZATION,
p.element.getNodeName()
));
ehf.error(
c.getOwner().getLocator(),
Messages.format(
Messages.ERR_UNACKNOWLEDGED_CUSTOMIZATION_LOCATION));
}
}
}
if(ehf.hadError())
o = null;
return o;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:57,代码来源:Model.java
示例6: ModelLoader
import com.sun.tools.internal.xjc.util.ErrorReceiverFilter; //导入依赖的package包/类
public ModelLoader(Options _opt, JCodeModel _codeModel, ErrorReceiver er) {
this.opt = _opt;
this.codeModel = _codeModel;
this.errorReceiver = new ErrorReceiverFilter(er);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:ModelLoader.java
注:本文中的com.sun.tools.internal.xjc.util.ErrorReceiverFilter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论