/** * Checks if the XS Particle is of array type * @param xsparticle * @return */ public boolean isArrayType(XSParticle xsparticle) { //Determine if it is an arrayType int maxOccurs = xsparticle.getMaxOccurs(); return xsparticle.getMaxOccursUnbounded() || maxOccurs > 1; }
public int getMaxOccurs() { return this.particle.getMaxOccurs(); }
boolean isParticleRedundant( XSParticle particle ) { if ( particle.getMaxOccursUnbounded() ) { return false; } return particle.getMinOccurs() == 1 && particle.getMaxOccurs() == 1; }
private void analyzeParticle(XSParticle particle, String parentName, String namespace) { // Is this right, can a particle be null? if (particle == null) return; XSTerm term = particle.getTerm(); // Is this right, can a term be null? if (term == null) return; switch (term.getType()) { case XSConstants.MODEL_GROUP: XSModelGroup group = (XSModelGroup)term; XSObjectList list = group.getParticles(); for (int i = 0; i < list.getLength(); i++) analyzeParticle((XSParticle)list.item(i), parentName, namespace); break; case XSConstants.ELEMENT_DECLARATION: XSElementDeclaration decl = (XSElementDeclaration)term; analyzeElement(decl, parentName, namespace, new Integer(particle.getMinOccurs()), new Integer(particle.getMaxOccurs())); } }
private static boolean isRepeatable(XSParticle particle) { return particle.getMaxOccursUnbounded() || particle.getMaxOccurs() > 1 || particle.getMinOccurs() > 1; }
case XSConstants.ELEMENT_DECLARATION: particle = processElement(parent, path, (XSElementDeclaration) xsTerm, substitutions, parents, xsParticle.getMinOccurs(), xsParticle.getMaxOccurs()); break;
String generateOccurenceInfo( XSParticle particle ) { return "(minOccurs=" + particle.getMinOccurs() + ", maxOccurs=" + ( particle.getMaxOccursUnbounded() ? "unbounded" : particle.getMaxOccurs() ) + ")"; }
private static boolean isArrayWrapper(XSTypeDefinition type) { boolean is = false; if(XSTypeDefinition.COMPLEX_TYPE == type.getTypeCategory()) { XSComplexTypeDefinition cType = (XSComplexTypeDefinition)type; XSParticle particle = cType.getParticle(); if(particle != null) { is = particle.getMaxOccursUnbounded() || particle.getMaxOccurs() > 1; } } return is; }
private boolean isGroupTypeWithMultipleOccurs(XSParticle particle) { if (particle == null) return false; XSTerm term = particle.getTerm(); if (term.getType() != XSConstants.MODEL_GROUP) return false; XSModelGroup group = (XSModelGroup) term; final short compositor = group.getCompositor(); switch(compositor) { case XSModelGroup.COMPOSITOR_CHOICE: case XSModelGroup.COMPOSITOR_SEQUENCE: return particle.getMaxOccurs() > 1 || particle.getMaxOccursUnbounded(); default: return false; } }
childElMappings.addAll( generateMapping( particle.getTerm(), -1, mc, parentEls, parentCTs ) ); } else { for ( int i = 1; i <= particle.getMaxOccurs(); i++ ) { childElMappings.addAll( generateMapping( particle.getTerm(), i, mc, new ArrayList<XSElementDeclaration>( parentEls ),
for ( int i = 0; i < particles.getLength(); i++ ) { XSParticle particle = (XSParticle) particles.item( i ); exportTerm( writer, particle.getTerm(), particle.getMinOccurs(), particle.getMaxOccurs(), particle.getMaxOccursUnbounded() );
int maxoccurs = xsp.getMaxOccurs(); if (!(minoccurs == 0 && maxoccurs == 0) && !(minoccurs == 1 && maxoccurs == 1)) else buf.append(" maxOccurs='" + xsp.getMaxOccurs() + "'");
public static XSElementDeclaration unwrapArrayType(XSTypeDefinition xst) { if (xst instanceof XSComplexTypeDefinition == false) return null; XSComplexTypeDefinition xc = (XSComplexTypeDefinition)xst; if (xc.getContentType() == XSComplexTypeDefinition.CONTENTTYPE_EMPTY) return null; XSParticle xsp = xc.getParticle(); if (xsp == null) return null; XSTerm xsterm = xsp.getTerm(); if (xsterm instanceof XSModelGroup == false) return null; XSModelGroup xm = (XSModelGroup)xsterm; XSObjectList xo = xm.getParticles(); if (xo.getLength() != 1) return null; XSParticle xp = (XSParticle)xo.item(0); XSTerm term = xp.getTerm(); if ((xp.getMaxOccursUnbounded() || xp.getMaxOccurs() > 1) == false || term instanceof XSElementDeclaration == false) return null; return (XSElementDeclaration)term; }
XSParticle particle = getEnclosingParticle( propDecl ); if ( particle != null ) { int maxOccurs = particle.getMaxOccurs(); boolean maxOccursUnbounded = particle.getMaxOccursUnbounded(); return maxOccurs > 1 || maxOccursUnbounded;
boolean array = particle.getMaxOccurs() > 1 || particle.getMaxOccursUnbounded(); case XSConstants.MODEL_GROUP: XSModelGroup subGroup = (XSModelGroup) term; if (particle.getMaxOccurs() <= 1 && !particle.getMaxOccursUnbounded()) createGroupFields(subGroup, fields, forceOptional || insideChoice); else {
final XSParticle particle = typeDef.getParticle(); final int minOccurs = particle.getMinOccurs(); final int maxOccurs = particle.getMaxOccursUnbounded() ? -1 : particle.getMaxOccurs(); final XSTerm term = particle.getTerm(); switch ( term.getType() ) {
int minOccurs = getCombinedOccurs( parentMinOccurs, particle.getMinOccurs() ); int maxOccurs = getCombinedOccurs( parentMaxOccurs, particle.getMaxOccursUnbounded() ? -1 : particle.getMaxOccurs() );
particleBinding.setMaxOccursUnbounded(particle.getMaxOccursUnbounded()); particleBinding.setMinOccurs(particle.getMinOccurs()); particleBinding.setMaxOccurs(particle.getMaxOccurs()); (XSElementDeclaration)term, particle.getMinOccurs(), particle.getMaxOccurs(), particle.getMaxOccursUnbounded() );
private void collectProperties( XSParticle particle, List<PropertyDeclaration> properties ) { switch ( particle.getTerm().getType() ) { case XSConstants.MODEL_GROUP: { XSModelGroup modelGroup = (XSModelGroup) particle.getTerm(); XSObjectList subParticles = modelGroup.getParticles(); for ( int i = 0; i < subParticles.getLength(); i++ ) { XSParticle subParticle = (XSParticle) subParticles.item( i ); collectProperties( subParticle, properties ); } break; } case XSConstants.ELEMENT_DECLARATION: { XSElementDeclaration elementDecl = (XSElementDeclaration) particle.getTerm(); QName propertyName = new QName( elementDecl.getNamespace(), elementDecl.getName() ); String minOccurs = "" + particle.getMinOccurs(); String maxOccurs = particle.getMaxOccursUnbounded() ? "unbounded" : "" + particle.getMaxOccurs(); QName propertyType = new QName( elementDecl.getTypeDefinition().getNamespace(), elementDecl.getTypeDefinition().getName() ); PropertyDeclaration property = new PropertyDeclaration( propertyName, minOccurs, maxOccurs, propertyType ); properties.add( property ); break; } case XSConstants.WILDCARD: { break; } default: { // cannot happen } } }
private void bindWildcard(XSParticle particle) { WildcardBinding binding = new WildcardBinding(schema); ModelGroupBinding group = (ModelGroupBinding)peekTypeOrGroup(); ParticleBinding particleBinding = new ParticleBinding(binding); particleBinding.setMaxOccurs(particle.getMaxOccurs()); particleBinding.setMaxOccursUnbounded(particle.getMaxOccursUnbounded()); particleBinding.setMinOccurs(particle.getMinOccurs()); group.addParticle(particleBinding); XSWildcard wildcard = (XSWildcard)particle.getTerm(); if(wildcard.getName() != null) { binding.setQName(new QName(wildcard.getNamespace(), wildcard.getName())); } binding.setProcessContents(wildcard.getProcessContents()); if (processAnnotations) { XSAnnotation annotation = wildcard.getAnnotation(); if(annotation != null) { customizeTerm(annotation, binding, trace); } } }