Refine search
protected void processParticle(XSParticle particle, ParseContext parseContext) throws Exception { parseContext.minOccurs = particle.getMinOccurs().intValue(); parseContext.maxOccurs = particle.getMaxOccurs().intValue(); XSTerm term = particle.getTerm(); if (term.isModelGroup()) { processGroup(term.asModelGroup(), parseContext); } else if (term.isModelGroupDecl()) { processGroupDecl(term.asModelGroupDecl(), parseContext); } else if (term.isElementDecl()) { processElement(term.asElementDecl(), parseContext); } }
public void modelGroup(XSModelGroup mg) { String operator; if(mg.getCompositor()==XSModelGroup.CHOICE) operator = "Or"; else operator = "And"; int size = mg.getSize(); for( int i=0; i<size; i++ ) { XSParticle p = mg.getChild(i); boolean oldRep = rep; rep |= p.isRepeated(); p.getTerm().visit(this); rep = oldRep; if(count==3) return; // we have enough if(i!=size-1) name.append(operator); } }
public Multiplicity particle( XSParticle p ) { Multiplicity m = p.getTerm().apply(this); BigInteger max; if (m.max==null || (BigInteger.valueOf(XSParticle.UNBOUNDED).equals(p.getMaxOccurs()))) max=null; else max=p.getMaxOccurs(); return Multiplicity.multiply( m, Multiplicity.create(p.getMinOccurs(),max) ); }
private XSModelGroup getTopLevelModelGroup(XSParticle p) { XSModelGroup mg = p.getTerm().asModelGroup(); if( p.getTerm().isModelGroupDecl() ) mg = p.getTerm().asModelGroupDecl().getModelGroup(); return mg; }
public boolean isOptional(final String elementName) { for (final Entry<String, XSComplexType> entry : getComplexTypes().entrySet()) { final XSContentType content = entry.getValue().getContentType(); final XSParticle particle = content.asParticle(); if (null != particle) { final XSTerm term = particle.getTerm(); if (term.isModelGroup()) { final XSParticle[] particles = term.asModelGroup().getChildren(); for (final XSParticle p : particles) { final XSTerm pterm = p.getTerm(); if (pterm.isElementDecl()) { final XSElementDecl e = pterm.asElementDecl(); if (0 == e.getName().compareToIgnoreCase(elementName)) { return p.getMinOccurs() == 0; } } } } } } return true; }
XSTerm t = p.getTerm(); if(t.isElementDecl()) return makeJavaName(p,t.asElementDecl().getName()); if(t.isModelGroupDecl()) return makeJavaName(p,t.asModelGroupDecl().getName()); if(t.isWildcard()) if(t.isModelGroup()) { try { return getSpecDefaultName(t.asModelGroup(),p.isRepeated()); } catch( ParseException e ) { getErrorReporter().error(t.getLocator(), Messages.ERR_UNABLE_TO_GENERATE_NAME_FROM_MODELGROUP); return "undefined"; // recover from error by assuming something
if (term != null && term.isModelGroup()) { modelGroup = term.asModelGroup(); if (XSModelGroup.CHOICE.equals(modelGroup.getCompositor())) { goingup = false; ps = modelGroup.getChildren(); for (int i = 0; i < ps.length; i++) { p = ps[i]; term = p.getTerm(); if (term.isModelGroup()) { write(st, term, goingup, xss); } else if (term.isElementDecl()) { if (term.asElementDecl().getType().getName() == null) { final String typeName = processType(term .asElementDecl().getType(), term .asElementDecl().getName(), xss); String ns = null; if (map.containsKey(typeName)) { ns = map.get(typeName).getNamespace(); st.addField(term.asElementDecl().getName(), ns, typeName, (goingup && p.getMinOccurs() .intValue() != 0), p.getMaxOccurs() .intValue() != 1, term.asElementDecl() st.addField(term.asElementDecl().getName(), term.asElementDecl().getType() .getTargetNamespace(), term .asElementDecl().getType().getName(),
/** * Gets the {@link BIDom} object that applies to the given particle. */ protected final BIDom getLocalDomCustomization( XSParticle p ) { if (p == null) { return null; } BIDom dom = getBindInfo(p).get(BIDom.class); if(dom!=null) return dom; // if not, the term might have one. dom = getBindInfo(p.getTerm()).get(BIDom.class); if(dom!=null) return dom; XSTerm t = p.getTerm(); // type could also have one, in case of the dom customization if(t.isElementDecl()) return getBindInfo(t.asElementDecl().getType()).get(BIDom.class); // similarly the model group in a model group definition may have one. if(t.isModelGroupDecl()) return getBindInfo(t.asModelGroupDecl().getModelGroup()).get(BIDom.class); return null; }
/** * Determine whether the definition contains xsd:any (directly or indirectly) */ private boolean isAny(XSTerm term) { if (term.isWildcard()) { return true; } if (term.isModelGroup()) { XSParticle[] children = term.asModelGroup().getChildren(); if (children != null) { for (XSParticle childParticle : children) { XSTerm childTerm = childParticle.getTerm(); if (childTerm != null) { if (isAny(childTerm)) { return true; } } } } } return false; }
public void particle( XSParticle p ) { if(getLocalPropCustomization(p)!=null || builder.getLocalDomCustomization(p)!=null) { // if a property customization is specfied, // check that value and turn around. check(p); mark(p); return; } XSTerm t = p.getTerm(); if(p.isRepeated() && (t.isModelGroup() || t.isModelGroupDecl())) { // a repeated model group gets its own property mark(p); return; } if(forcedProps.contains(p)) { // this particle must become a property mark(p); return; } outerParticle = p; t.visit(this); }
public void particle(XSParticle p) { // determine the binding of this complex type. builder.recordBindingMode(ct, bgmBuilder.getParticleBinder().checkFallback(p)?FALLBACK_CONTENT:NORMAL); bgmBuilder.getParticleBinder().build(p); XSTerm term = p.getTerm(); if(term.isModelGroup() && term.asModelGroup().getCompositor()==XSModelGroup.ALL) selector.getCurrentBean().setOrdered(false); }
private CCustomizations getCustomizations( XSParticle src ) { // customizations for a particle should include those defined in the term unless it's global // this is so that the schema like: // // <xs:sequence> // <xs:element name="foo" type="xs:int"> // <xs:annotation><xs:appinfo> // <hyperjaxb:... /> // // would be picked up if(src.getTerm().isElementDecl()) { XSElementDecl xed = src.getTerm().asElementDecl(); if(xed.isGlobal()) return getCustomizations((XSComponent)src); } return getCustomizations(src,src.getTerm()); }
public Expression particle(XSParticle p) { current = p; Expression e = p.getTerm().apply(this); if(p.isRepeated()) e = new OneOrMore(e); if (BigInteger.ZERO.equals(p.getMinOccurs())) e = new Choice(e,Expression.EPSILON); return e; }
private void visit(XSModelGroup mg, List<XSComponent> r) { // since model groups never form a cycle, no cycle check is needed r.add(mg); for (XSParticle p : mg) { XSModelGroup child = p.getTerm().asModelGroup(); if(child!=null) visit(child,r); } }
public Iterator<XSElementDecl> particle(XSParticle particle) { return singleton(particle.getTerm().asElementDecl()); }
private boolean containingChoice(CClassInfo typeBean) { XSComponent component = typeBean.getSchemaComponent(); if (component instanceof XSComplexType) { XSContentType contentType = ((XSComplexType) component).getContentType(); XSParticle particle = contentType.asParticle(); if (particle != null) { XSTerm term = particle.getTerm(); XSModelGroup modelGroup = term.asModelGroup(); if (modelGroup != null) { return (modelGroup.getCompositor() == XSModelGroup.Compositor.CHOICE); } } } return false; }
public Iterator<XSModelGroupDecl> particle(XSParticle particle) { return singleton(particle.getTerm().asModelGroupDecl()); }
private boolean containsDefaultValue(Outline outline, FieldOutline field) { ClassOutline fClass = null; for (ClassOutline classOutline : outline.getClasses()) { if (classOutline.implClass == field.getRawType() && !classOutline.implClass.isAbstract()) { fClass = classOutline; break; } } if (fClass == null) { return false; } for (FieldOutline f : fClass.getDeclaredFields()) { if (f.getPropertyInfo().getSchemaComponent() instanceof XSParticle) { XSParticle particle = (XSParticle)f.getPropertyInfo().getSchemaComponent(); XSTerm term = particle.getTerm(); if (term.isElementDecl() && term.asElementDecl().getDefaultValue() != null) { return true; } } } return false; }