public StringList getLexicalEnumeration() { if (xsSimple == null) return new JBossXSStringList(enumerations); return xsSimple.getLexicalEnumeration(); }
private void exportSimpleType( XMLStreamWriter writer, XSSimpleTypeDefinition simple ) throws XMLStreamException { writer.writeStartElement( "simpleType" ); if ( !simple.getAnonymous() ) { writer.writeAttribute( "name", simple.getName() ); } // TODO how can one find the derivation type? getFinal() is wrong! LOG.debug( "Exporting a simple type is done always by restriction. Other derivations may be possible?!" ); writer.writeStartElement( "restriction" ); QName qName = new QName( simple.getBaseType().getNamespace(), simple.getBaseType().getName() ); writer.writeAttribute( "base", getPrefixedName( qName ) ); StringList members = simple.getLexicalEnumeration(); if ( members != null && members.getLength() > 0 ) { for ( int i = 0; i < members.getLength(); i++ ) { writer.writeEmptyElement( "enumeration" ); writer.writeAttribute( "value", members.item( i ) ); } } writer.writeEndElement(); // derivation (restriction, extension, etc.) writer.writeEndElement(); // simpleType }
StringList list = ((XSSimpleTypeDefinition)xstype).getLexicalEnumeration(); for (int i = 0; i < list.getLength(); i++)
StringList lexicalEnumeration = type.getLexicalEnumeration(); if(lexicalEnumeration != null && lexicalEnumeration.getLength() > 0)
public static boolean checkEnumType(XSTypeDefinition td) { final XSSimpleTypeDefinition st; if (td.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) { XSComplexTypeDefinition ctd = (XSComplexTypeDefinition) td; if (ctd.getContentType() != XSComplexTypeDefinition.CONTENTTYPE_SIMPLE) { return false; } if (ctd.getAttributeUses() != null) { for (int i = 0; i < ctd.getAttributeUses().getLength(); i++) { XSSimpleTypeDefinition xsstd = ((XSAttributeUse) ctd.getAttributeUses() .item(i)).getAttrDeclaration() .getTypeDefinition(); if ("ID".equals(xsstd.getName())) { continue; } return false; } } st = ctd.getSimpleType(); } else if (td.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) { st = (XSSimpleTypeDefinition) td; } else { return false; } return st.getLexicalEnumeration() != null && st.getLexicalEnumeration().getLength() != 0; }
public void processEnumType( XSTypeDefinition def, Map<String, TypeDesc> jtMap, Map<String, NamespaceDesc> nsdMap ) throws Exception { boolean complexType = def instanceof XSComplexTypeDefinition; if (!nsdMap.containsKey(def.getNamespace())) { Util.log("Namespace desc not found for: " + def); } final String typeName = toJavaTypeName(def, nsdMap); final TypeDesc td = new TypeDesc(def.getName(), def.getNamespace(), typeName, TypeDesc.TypeEnum.ENUM); final XSComplexTypeDefinition ct = complexType ? (XSComplexTypeDefinition) def : null; final XSSimpleTypeDefinition st = (XSSimpleTypeDefinition) (complexType ? ((XSComplexTypeDefinition) def).getSimpleType() : def); for (int i = 0; i < st.getLexicalEnumeration().getLength(); i++) { final String s = st.getLexicalEnumeration().item(i); td.fdMap.put(s, new FieldDesc(Util.computeEnumConstantName(s, td.name), s)); } final XSObjectList anns = complexType ? ct.getAnnotations() : st.getAnnotations(); td.documentation = parseAnnotationString( "Enumeration " + def.getNamespace() + ":" + def.getName() + " documentation", anns != null && anns.getLength() > 0 ? ((XSAnnotation) anns.item(0)).getAnnotationString() : null ); jtMap.put(model.toJavaQualifiedTypeName(def, nsdMap, true), td); }
strList = type.getLexicalEnumeration(); if(strList != null && strList.getLength() > 0)