/** * Checks if the given component is being mapped to a type. * If so, build that type and return that object. * If it is not being mapped to a type item, return null. */ public CTypeInfo bindToType( XSComponent sc, XSComponent referer ) { return _bindToClass(sc,referer,false); }
/** * Checks if the given component is bound to a class. */ public final CElement isBound( XSElementDecl x, XSComponent referer ) { CElementInfo r = boundElements.get(x); if(r!=null) return r; return bindToType(x,referer); }
protected final CClassInfo getCurrentBean() { return selector.getCurrentBean(); } protected final XSComponent getCurrentRoot() {
isGlobal = ((XSDeclaration)sc).isGlobal(); if( isGlobal ) pushClassScope( new CClassInfoParent.Package( getPackage(((XSDeclaration)sc).getTargetNamespace())) ); popClassScope(); if(sb!=null && !sb.map) { getErrorReporter().error(sc.getLocator(), Messages.ERR_REFERENCE_TO_NONEXPORTED_CLASS, sc.apply( new ComponentNameFunction() ) ); getErrorReporter().error(sb.getLocation(), Messages.ERR_REFERENCE_TO_NONEXPORTED_CLASS_MAP_FALSE, os.getTargetNamespace() ); if(referer!=null) getErrorReporter().error(referer.getLocator(), Messages.ERR_REFERENCE_TO_NONEXPORTED_CLASS_REFERER, referer.apply( new ComponentNameFunction() ) ); queueBuild( sc, bean );
/** Fill-in the contents of each classes. */ private void buildContents() { ClassSelector cs = getClassSelector(); SimpleTypeBuilder stb = Ring.get(SimpleTypeBuilder.class); for( XSSchema s : Ring.get(XSSchemaSet.class).getSchemas() ) { BISchemaBinding sb = getBindInfo(s).get(BISchemaBinding.class); if(sb!=null && !sb.map) { sb.markAsAcknowledged(); continue; // no mapping for this package } getClassSelector().pushClassScope( new CClassInfoParent.Package( getClassSelector().getPackage(s.getTargetNamespace())) ); checkMultipleSchemaBindings(s); processPackageJavadoc(s); populate(s.getAttGroupDecls(),s); populate(s.getAttributeDecls(),s); populate(s.getElementDecls(),s); populate(s.getModelGroupDecls(),s); // fill in typeUses for (XSType t : s.getTypes().values()) { stb.refererStack.push(t); model.typeUses().put( getName(t), cs.bindToType(t,s) ); stb.refererStack.pop(); } getClassSelector().popClassScope(); } }
getErrorReporter().error( sc.getLocator(), Messages.ERR_RESERVED_CLASS_NAME, reservedClassName ); break; pushClassScope(bean); else pushClassScope(bean.parent()); XSComponent oldRoot = currentRoot; CClassInfo oldBean = currentBean; currentBean = oldBean; currentRoot = oldRoot; popClassScope();
JPackage pkg = selector.getPackage(type.getTargetNamespace()); return new CClassInfo( model, selector.getClassScope(), deriveName(element), element.getLocator(), null, getName(element), element, bi.toCustomizationList() ); CElement parentType = selector.isBound(element,type); type.getOwnerSchema() ).get(BISchemaBinding.class); if(sb!=null) className = sb.mangleAnonymousTypeClassName(className); scope = selector.getClassScope();
return selector.bindToType(decl.getType().asComplexType(),decl,true); } else { String className = null; model, tagName, selector.getClassScope(), className, custs, decl.getLocator()); selector.boundElements.put(decl,cei); cei.initContentType( selector.bindToType(decl.getType(),decl), decl, decl.getDefaultValue() ); stb.refererStack.pop(); r = cei; CElement topci = selector.bindToType(top,decl);
public CElement simpleType(XSSimpleType type) { CElement c = allow(type,type.getName()); if(c!=null) return c; if(getGlobalBinding().isSimpleTypeSubstitution() && type.isGlobal()) { return new CClassInfo(model,selector.getClassScope(), deriveName(type), type.getLocator(), getName(type), null, type, null ); } return never(); }
private void _build() { // do the binding buildContents(); getClassSelector().executeTasks(); // additional error check // Reports unused customizations to the user as errors. Ring.get(UnusedCustomizationChecker.class).run(); Ring.get(ModelChecker.class).check(); }
protected final XSComponent getCurrentRoot() { return selector.getCurrentRoot(); }
/** * Generates <code>package.html</code> if the customization * says so. */ private void processPackageJavadoc( XSSchema s ) { // look for the schema-wide customization BISchemaBinding cust = getBindInfo(s).get(BISchemaBinding.class); if(cust==null) return; // not present cust.markAsAcknowledged(); if( cust.getJavadoc()==null ) return; // no javadoc customization // produce a HTML file JTextFile html = new JTextFile("package.html"); html.setContents(cust.getJavadoc()); getClassSelector().getPackage(s.getTargetNamespace()).addResourceFile(html); }
getErrorReporter().error(s.getLocator(), Messages.ERR_INCORRECT_PACKAGE_NAME, targetNamespace, name );
isGlobal = ((XSDeclaration)sc).isGlobal(); if( isGlobal ) pushClassScope( new CClassInfoParent.Package( getPackage(((XSDeclaration)sc).getTargetNamespace())) ); popClassScope(); if(sb!=null && !sb.map) { getErrorReporter().error(sc.getLocator(), Messages.ERR_REFERENCE_TO_NONEXPORTED_CLASS, sc.apply( new ComponentNameFunction() ) ); getErrorReporter().error(sb.getLocation(), Messages.ERR_REFERENCE_TO_NONEXPORTED_CLASS_MAP_FALSE, os.getTargetNamespace() ); if(referer!=null) getErrorReporter().error(referer.getLocator(), Messages.ERR_REFERENCE_TO_NONEXPORTED_CLASS_REFERER, referer.apply( new ComponentNameFunction() ) ); queueBuild( sc, bean );
/** Fill-in the contents of each classes. */ private void buildContents() { ClassSelector cs = getClassSelector(); SimpleTypeBuilder stb = Ring.get(SimpleTypeBuilder.class); for( XSSchema s : Ring.get(XSSchemaSet.class).getSchemas() ) { BISchemaBinding sb = getBindInfo(s).get(BISchemaBinding.class); if(sb!=null && !sb.map) { sb.markAsAcknowledged(); continue; // no mapping for this package } getClassSelector().pushClassScope( new CClassInfoParent.Package( getClassSelector().getPackage(s.getTargetNamespace())) ); checkMultipleSchemaBindings(s); processPackageJavadoc(s); populate(s.getAttGroupDecls(),s); populate(s.getAttributeDecls(),s); populate(s.getElementDecls(),s); populate(s.getModelGroupDecls(),s); // fill in typeUses for (XSType t : s.getTypes().values()) { stb.refererStack.push(t); model.typeUses().put( getName(t), cs.bindToType(t,s) ); stb.refererStack.pop(); } getClassSelector().popClassScope(); } }
getErrorReporter().error( sc.getLocator(), Messages.ERR_RESERVED_CLASS_NAME, reservedClassName ); break; pushClassScope(bean); else pushClassScope(bean.parent()); XSComponent oldRoot = currentRoot; CClassInfo oldBean = currentBean; currentBean = oldBean; currentRoot = oldRoot; popClassScope();
JPackage pkg = selector.getPackage(type.getTargetNamespace()); return new CClassInfo( model, selector.getClassScope(), deriveName(element), element.getLocator(), null, getName(element), element, bi.toCustomizationList() ); CElement parentType = selector.isBound(element,type); type.getOwnerSchema() ).get(BISchemaBinding.class); if(sb!=null) className = sb.mangleAnonymousTypeClassName(className); scope = selector.getClassScope();
return selector.bindToType(decl.getType().asComplexType(),decl,true); } else { String className = null; model, tagName, selector.getClassScope(), className, custs, decl.getLocator()); selector.boundElements.put(decl,cei); cei.initContentType( selector.bindToType(decl.getType(),decl), decl, decl.getDefaultValue() ); stb.refererStack.pop(); r = cei; CElement topci = selector.bindToType(top,decl);
public CElement simpleType(XSSimpleType type) { CElement c = allow(type,type.getName()); if(c!=null) return c; if(getGlobalBinding().isSimpleTypeSubstitution() && type.isGlobal()) { return new CClassInfo(model,selector.getClassScope(), deriveName(type), type.getLocator(), getName(type), null, type, null ); } return never(); }