public void restrictionSimpleType( XSRestrictionSimpleType type ) { if(type.getBaseType()==null) { // don't print anySimpleType if(!type.getName().equals("anySimpleType")) throw new InternalError(); if(!Const.schemaNamespace.equals(type.getTargetNamespace())) throw new InternalError(); return; } XSSimpleType baseType = type.getSimpleBaseType(); println(MessageFormat.format("<restriction{0}>", baseType.isLocal()?"":" base=\"{"+ baseType.getTargetNamespace()+'}'+ baseType.getName()+'\"')); indent++; if(baseType.isLocal()) simpleType(baseType); Iterator itr = type.iterateDeclaredFacets(); while(itr.hasNext()) facet( (XSFacet)itr.next() ); indent--; println("</restriction>"); }
public T restrictionSimpleType( XSRestrictionSimpleType restrictionSimpleType) { final List<T> values = new LinkedList<T>(); final T parentValue; if (restrictionSimpleType.getBaseType() != null) { parentValue = restrictionSimpleType.getBaseType().apply(this); } else { parentValue = null; } values.add(parentValue); // for () for (XSFacet facet : restrictionSimpleType.getDeclaredFacets()) { final T facetValue = facet.apply(this); values.add(facetValue); } return aggregate(values); }
private void createEnum(String name, String namespace, XSRestrictionSimpleType type) { Enumeration en; Iterator<? extends XSFacet> it; if (!enums.containsKey(name)) { type = type.asRestriction(); en = new Enumeration(name, NamespaceConverter.convertFromSchema(namespace)); it = type.getDeclaredFacets().iterator(); while (it.hasNext()) { en.addString(it.next().getValue().value); } enums.put(name, en); } }
loc = type.getLocator(); if( !type.isGlobal() ) { getErrorReporter().error( loc, Messages.ERR_NO_ENUM_NAME_AVAILABLE ); className = type.getName(); type.visit((XSVisitor)sw); javadoc += Messages.format( Messages.JAVADOC_HEADING, type.getName() ) +"\n<p>\n<pre>\n"+out.getBuffer()+"</pre>"; refererStack.push(type.getSimpleBaseType()); TypeUse use = build(type.getSimpleBaseType()); refererStack.pop(); if(type.isGlobal()) scope = new CClassInfoParent.Package(getClassSelector().getPackage(type.getTargetNamespace())); else scope = getClassSelector().getClassScope(); xducer.javadoc = javadoc; BIConversion conv = new BIConversion.Static( type.getLocator(),xducer); conv.markAsAcknowledged();
if( type.isLocal() ) return false; if( type.getRedefinedBy()!=null ) return false; List<XSFacet> facets = type.getDeclaredFacets(XSFacet.FACET_ENUMERATION); if( facets.isEmpty() ) getErrorReporter().warning(type.getLocator(), Messages.WARN_ENUM_MEMBER_SIZE_CAP, type.getName(), facets.size(), builder.getGlobalBinding().getDefaultEnumMemberSizeCap());
public void restrictionSimpleType(XSRestrictionSimpleType type) { if(check(type)) type.getBaseType().visit(this); }
Set<String> enums = new HashSet<String>(); // to avoid duplicates. See issue #366 for( XSFacet facet : type.getDeclaredFacets(XSFacet.FACET_ENUMERATION)) { String name=null; String mdoc=builder.getBindInfo(facet).getDocumentation();
/** * Returns true if a type-safe enum should be created from * the given simple type by default without an explicit <jaxb:enum> customization. */ private boolean shouldBeMappedToTypeSafeEnumByDefault( XSRestrictionSimpleType type ) { // if not, there will be a problem wrt the class name of this type safe enum type. if( type.isLocal() ) return false; // if redefined, we should map the new definition, not the old one. if( type.getRedefinedBy()!=null ) return false; List<XSFacet> facets = type.getDeclaredFacets(XSFacet.FACET_ENUMERATION); if( facets.isEmpty() || facets.size()>builder.getGlobalBinding().getDefaultEnumMemberSizeCap() ) // if the type itself doesn't have the enumeration facet, // it won't be mapped to a type-safe enum. // // if there are too many facets, it's not very useful return false; if( !canBeMappedToTypeSafeEnum(type) ) // we simply can't map this to an enumeration return false; // check for collisions among constant names. if a collision will happen, // don't try to bind it to an enum. // return true only when this type is derived from one of the "enum base type". for( XSSimpleType t = type; t!=null; t=t.getSimpleBaseType() ) if( t.isGlobal() && builder.getGlobalBinding().canBeMappedToTypeSafeEnum(t) ) return true; return false; }
public TypeUse restrictionSimpleType(XSRestrictionSimpleType type) { // just process the base type. return compose(type.getSimpleBaseType()); } };
public Iterator<XSFacet> simpleType(XSSimpleType type) { // TODO: it's not clear if "facets" mean all inherited facets or just declared facets XSRestrictionSimpleType r = type.asRestriction(); if(r!=null) return r.iterateDeclaredFacets(); else return empty(); }
loc = type.getLocator(); if( !type.isGlobal() ) { getErrorReporter().error( loc, Messages.ERR_NO_ENUM_NAME_AVAILABLE ); className = type.getName(); type.visit((XSVisitor)sw); javadoc += Messages.format( Messages.JAVADOC_HEADING, type.getName() ) +"\n<p>\n<pre>\n"+out.getBuffer()+"</pre>"; refererStack.push(type.getSimpleBaseType()); TypeUse use = build(type.getSimpleBaseType()); refererStack.pop(); if(type.isGlobal()) scope = new CClassInfoParent.Package(getClassSelector().getPackage(type.getTargetNamespace())); else scope = getClassSelector().getClassScope(); xducer.javadoc = javadoc; BIConversion conv = new BIConversion.Static( type.getLocator(),xducer); conv.markAsAcknowledged();
if( type.isLocal() ) return false; if( type.getRedefinedBy()!=null ) return false; List<XSFacet> facets = type.getDeclaredFacets(XSFacet.FACET_ENUMERATION); if( facets.isEmpty() ) getErrorReporter().warning(type.getLocator(), Messages.WARN_ENUM_MEMBER_SIZE_CAP, type.getName(), facets.size(), builder.getGlobalBinding().getDefaultEnumMemberSizeCap());
public void restrictionSimpleType(XSRestrictionSimpleType type) { if(check(type)) type.getBaseType().visit(this); }
Vector<String> pattern = new Vector<String>(); for (XSFacet facet : restriction.getDeclaredFacets()) { if (facet.getName().equals(XSFacet.FACET_ENUMERATION)) { enumeration.add(facet.getValue().value);
/** * Returns true if a type-safe enum should be created from * the given simple type by default without an explicit <jaxb:enum> customization. */ private boolean shouldBeMappedToTypeSafeEnumByDefault( XSRestrictionSimpleType type ) { // if not, there will be a problem wrt the class name of this type safe enum type. if( type.isLocal() ) return false; // if redefined, we should map the new definition, not the old one. if( type.getRedefinedBy()!=null ) return false; List<XSFacet> facets = type.getDeclaredFacets(XSFacet.FACET_ENUMERATION); if( facets.isEmpty() || facets.size()>builder.getGlobalBinding().getDefaultEnumMemberSizeCap() ) // if the type itself doesn't have the enumeration facet, // it won't be mapped to a type-safe enum. // // if there are too many facets, it's not very useful return false; if( !canBeMappedToTypeSafeEnum(type) ) // we simply can't map this to an enumeration return false; // check for collisions among constant names. if a collision will happen, // don't try to bind it to an enum. // return true only when this type is derived from one of the "enum base type". for( XSSimpleType t = type; t!=null; t=t.getSimpleBaseType() ) if( t.isGlobal() && builder.getGlobalBinding().canBeMappedToTypeSafeEnum(t) ) return true; return false; }
public TypeUse restrictionSimpleType(XSRestrictionSimpleType type) { // just process the base type. return compose(type.getSimpleBaseType()); } };
public Iterator<XSFacet> simpleType(XSSimpleType type) { // TODO: it's not clear if "facets" mean all inherited facets or just declared facets XSRestrictionSimpleType r = type.asRestriction(); if(r!=null) return r.iterateDeclaredFacets(); else return empty(); }
public void restrictionSimpleType( XSRestrictionSimpleType type ) { if(type.getBaseType()==null) { // don't print anySimpleType if(!type.getName().equals("anySimpleType")) throw new InternalError(); if(!Const.schemaNamespace.equals(type.getTargetNamespace())) throw new InternalError(); return; } XSSimpleType baseType = type.getSimpleBaseType(); println(MessageFormat.format("<restriction{0}>", baseType.isLocal()?"":" base=\"{"+ baseType.getTargetNamespace()+'}'+ baseType.getName()+'\"')); indent++; if(baseType.isLocal()) simpleType(baseType); Iterator itr = type.iterateDeclaredFacets(); while(itr.hasNext()) facet( (XSFacet)itr.next() ); indent--; println("</restriction>"); }
loc = type.getLocator(); if( !type.isGlobal() ) { getErrorReporter().error( loc, Messages.ERR_NO_ENUM_NAME_AVAILABLE ); className = type.getName(); type.visit((XSVisitor)sw); javadoc += Messages.format( Messages.JAVADOC_HEADING, type.getName() ) +"\n<p>\n<pre>\n"+out.getBuffer()+"</pre>"; refererStack.push(type.getSimpleBaseType()); TypeUse use = build(type.getSimpleBaseType()); refererStack.pop(); if(type.isGlobal()) scope = new CClassInfoParent.Package(getClassSelector().getPackage(type.getTargetNamespace())); else scope = getClassSelector().getClassScope(); xducer.javadoc = javadoc; BIConversion conv = new BIConversion.Static( type.getLocator(),xducer); conv.markAsAcknowledged();
if( type.isLocal() ) return false; if( type.getRedefinedBy()!=null ) return false; List<XSFacet> facets = type.getDeclaredFacets(XSFacet.FACET_ENUMERATION); if( facets.isEmpty() ) getErrorReporter().warning(type.getLocator(), Messages.WARN_ENUM_MEMBER_SIZE_CAP, type.getName(), facets.size(), builder.getGlobalBinding().getDefaultEnumMemberSizeCap());