本文整理汇总了Java中com.sun.tools.internal.xjc.ErrorReceiver类的典型用法代码示例。如果您正苦于以下问题:Java ErrorReceiver类的具体用法?Java ErrorReceiver怎么用?Java ErrorReceiver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ErrorReceiver类属于com.sun.tools.internal.xjc包,在下文中一共展示了ErrorReceiver类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: build
import com.sun.tools.internal.xjc.ErrorReceiver; //导入依赖的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: constantPropertyErrorCheck
import com.sun.tools.internal.xjc.ErrorReceiver; //导入依赖的package包/类
private void constantPropertyErrorCheck() {
if( isConstantProperty!=null && getOwner()!=null ) {
// run additional check on the isCOnstantProperty value.
// this value is not allowed if the schema component doesn't have
// a fixed value constraint.
//
// the setParent method associates a customization with the rest of
// XSOM object graph, so this is the earliest possible moment where
// we can test this.
if( !hasFixedValue.find(getOwner()) ) {
Ring.get(ErrorReceiver.class).error(
getLocation(),
Messages.ERR_ILLEGAL_FIXEDATTR.format()
);
// set this value to null to avoid the same error to be reported more than once.
isConstantProperty = null;
}
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:BIProperty.java
示例3: errorCheck
import com.sun.tools.internal.xjc.ErrorReceiver; //导入依赖的package包/类
/**
* Performs error check
*/
public void errorCheck() {
ErrorReceiver er = Ring.get(ErrorReceiver.class);
for (QName n : enumBaseTypes) {
XSSchemaSet xs = Ring.get(XSSchemaSet.class);
XSSimpleType st = xs.getSimpleType(n.getNamespaceURI(), n.getLocalPart());
if(st==null) {
er.error(loc,Messages.ERR_UNDEFINED_SIMPLE_TYPE.format(n));
continue;
}
if(!SimpleTypeBuilder.canBeMappedToTypeSafeEnum(st)) {
er.error(loc,Messages.ERR_CANNOT_BE_BOUND_TO_SIMPLETYPE.format(n));
continue;
}
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:BIGlobalBinding.java
示例4: dispatchGlobalConversions
import com.sun.tools.internal.xjc.ErrorReceiver; //导入依赖的package包/类
/**
* Moves global BIConversion to the right object.
*/
public void dispatchGlobalConversions( XSSchemaSet schema ) {
// also set parent to the global conversions
for( Map.Entry<QName,BIConversion> e : globalConversions.entrySet() ) {
QName name = e.getKey();
BIConversion conv = e.getValue();
XSSimpleType st = schema.getSimpleType(name.getNamespaceURI(),name.getLocalPart());
if(st==null) {
Ring.get(ErrorReceiver.class).error(
getLocation(),
Messages.ERR_UNDEFINED_SIMPLE_TYPE.format(name)
);
continue; // abort
}
getBuilder().getOrCreateBindInfo(st).addDecl(conv);
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:BIGlobalBinding.java
示例5: apply
import com.sun.tools.internal.xjc.ErrorReceiver; //导入依赖的package包/类
/**
* Applies the additional binding customizations.
*/
public void apply(XSSchemaSet schema, ErrorReceiver errorReceiver) {
if(topLevel!=null) {
this.errorReceiver = errorReceiver;
Unmarshaller u = BindInfo.getCustomizationUnmarshaller();
this.unmarshaller = u.getUnmarshallerHandler();
ValidatorHandler v = BindInfo.bindingFileSchema.newValidator();
v.setErrorHandler(errorReceiver);
loader = new ForkContentHandler(v,unmarshaller);
topLevel.applyAll(schema.getSchemas());
this.loader = null;
this.unmarshaller = null;
this.errorReceiver = null;
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:SCDBasedBindingSet.java
示例6: checkSchemaCorrectness
import com.sun.tools.internal.xjc.ErrorReceiver; //导入依赖的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
示例7: getType
import com.sun.tools.internal.xjc.ErrorReceiver; //导入依赖的package包/类
/**
* Obtains a {@link JType} object for the string representation
* of a type.
*/
public static JType getType( JCodeModel codeModel,
String typeName, ErrorReceiver errorHandler, Locator errorSource ) {
try {
return codeModel.parseType(typeName);
} catch( ClassNotFoundException ee ) {
// make it a warning
errorHandler.warning( new SAXParseException(
Messages.ERR_CLASS_NOT_FOUND.format(typeName)
,errorSource));
// recover by assuming that it's a class that derives from Object
return codeModel.directClass(typeName);
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:TypeUtil.java
注:本文中的com.sun.tools.internal.xjc.ErrorReceiver类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论