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); }
/** * Resolves the conversion name to the conversion declaration. * * <p> * Element-local declarations are checked first. * * @return * A non-null valid BIConversion object. */ public BIConversion conversion( String name ) { BIConversion r = conversions.get(name); if(r!=null) return r; // check the global conversion declarations return parent.conversion(name); }
private CClassInfo calcClass() { BIElement e = owner.bindInfo.element(name); if(e==null) { if(contentModelType!=DTDEventListener.CONTENT_MODEL_MIXED || !attributes.isEmpty() || mustBeClass) return createDefaultClass(); if(contentModel!=Term.EMPTY) { throw new UnsupportedOperationException("mixed content model not supported"); } else { // just #PCDATA if(isReferenced) return null; else // if no one else is referencing, assumed to be the root. return createDefaultClass(); } } else { return e.clazz; } }
public void endDTD() throws SAXException { // bind them all. // we need to know how elements are referencing each other before we do this, // so this can be only done at the endDTD method for( Element e : elements.values() ) e.bind(); // if there was an error by now, just abort. if (errorReceiver.hadError()) return; processInterfaceDeclarations(); // check XJC extensions and realize them model.serialVersionUID = bindInfo.getSerialVersionUID(); if(model.serialVersionUID!=null) model.serializable=true; model.rootClass = bindInfo.getSuperClass(); model.rootInterface = bindInfo.getSuperInterface(); // TODO: do we need to reimplement them? // // performs annotation // Annotator.annotate(model, this); // FieldCollisionChecker.check( model, this ); processConstructorDeclarations(); }
JPackage getTargetPackage() { return bindInfo.getTargetPackage(); }
for( BIInterface decl : bindInfo.interfaces() ) { final JDefinedClass intf = classFactory.createInterface( bindInfo.getTargetPackage(), decl.name(), copyLocator() ); decls.put(decl,intf); fromName.put(decl.name(),new InterfaceAcceptor() {
/** * Gets the specified package name (options/@package). */ public JPackage getTargetPackage() { if(model.options.defaultPackage!=null) // "-p" takes precedence over everything else return codeModel._package(model.options.defaultPackage); String p; if( defaultPackage!=null ) p = defaultPackage; else p = getOption("package", ""); return codeModel._package(p); }
/** * Creates constructor declarations as specified in the * binding information. * * <p> * Also checks that the binding file does not contain * declarations for non-existent elements. */ private void processConstructorDeclarations() { for( BIElement decl: bindInfo.elements() ) { Element e = elements.get(decl.name()); if(e==null) { error(decl.getSourceLocation(), Messages.ERR_BINDINFO_NON_EXISTENT_ELEMENT_DECLARATION,decl.name()); continue; // continue to process next declaration } if(!decl.isClass()) // only element-class declaration has constructor definitions continue; decl.declareConstructors(e.getClassInfo()); } }
model.getCustomizations().addAll(getGlobalCustomizations());
public void endDTD() throws SAXException { // bind them all. // we need to know how elements are referencing each other before we do this, // so this can be only done at the endDTD method for( Element e : elements.values() ) e.bind(); // if there was an error by now, just abort. if (errorReceiver.hadError()) return; processInterfaceDeclarations(); // check XJC extensions and realize them model.serialVersionUID = bindInfo.getSerialVersionUID(); if(model.serialVersionUID!=null) model.serializable=true; model.rootClass = bindInfo.getSuperClass(); model.rootInterface = bindInfo.getSuperInterface(); // TODO: do we need to reimplement them? // // performs annotation // Annotator.annotate(model, this); // FieldCollisionChecker.check( model, this ); processConstructorDeclarations(); }
JPackage getTargetPackage() { return bindInfo.getTargetPackage(); }
for( BIInterface decl : bindInfo.interfaces() ) { final JDefinedClass intf = classFactory.createInterface( bindInfo.getTargetPackage(), decl.name(), copyLocator() ); decls.put(decl,intf); fromName.put(decl.name(),new InterfaceAcceptor() {
/** * Gets the specified package name (options/@package). */ public JPackage getTargetPackage() { if(model.options.defaultPackage!=null) // "-p" takes precedence over everything else return codeModel._package(model.options.defaultPackage); String p; if( defaultPackage!=null ) p = defaultPackage; else p = getOption("package", ""); return codeModel._package(p); }
/** * Creates constructor declarations as specified in the * binding information. * * <p> * Also checks that the binding file does not contain * declarations for non-existent elements. */ private void processConstructorDeclarations() { for( BIElement decl: bindInfo.elements() ) { Element e = elements.get(decl.name()); if(e==null) { error(decl.getSourceLocation(), Messages.ERR_BINDINFO_NON_EXISTENT_ELEMENT_DECLARATION,decl.name()); continue; // continue to process next declaration } if(!decl.isClass()) // only element-class declaration has constructor definitions continue; decl.declareConstructors(e.getClassInfo()); } }
model.getCustomizations().addAll(getGlobalCustomizations());
public void endDTD() throws SAXException { // bind them all. // we need to know how elements are referencing each other before we do this, // so this can be only done at the endDTD method for( Element e : elements.values() ) e.bind(); // if there was an error by now, just abort. if (errorReceiver.hadError()) return; processInterfaceDeclarations(); // check XJC extensions and realize them model.serialVersionUID = bindInfo.getSerialVersionUID(); if(model.serialVersionUID!=null) model.serializable=true; model.rootClass = bindInfo.getSuperClass(); model.rootInterface = bindInfo.getSuperInterface(); // TODO: do we need to reimplement them? // // performs annotation // Annotator.annotate(model, this); // FieldCollisionChecker.check( model, this ); processConstructorDeclarations(); }
JPackage getTargetPackage() { return bindInfo.getTargetPackage(); }
for( BIInterface decl : bindInfo.interfaces() ) { final JDefinedClass intf = classFactory.createInterface( bindInfo.getTargetPackage(), decl.name(), copyLocator() ); decls.put(decl,intf); fromName.put(decl.name(),new InterfaceAcceptor() {
private CClassInfo calcClass() { BIElement e = owner.bindInfo.element(name); if(e==null) { if(contentModelType!=DTDEventListener.CONTENT_MODEL_MIXED || !attributes.isEmpty() || mustBeClass) return createDefaultClass(); if(contentModel!=Term.EMPTY) { throw new UnsupportedOperationException("mixed content model not supported"); } else { // just #PCDATA if(isReferenced) return null; else // if no one else is referencing, assumed to be the root. return createDefaultClass(); } } else { return e.clazz; } }
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); }