@Override public void writeSchema(XmlSchema root) { XmlSchemaSimpleType simple = new XmlSchemaSimpleType(root, true); simple.setName(getSchemaType().getLocalPart()); XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction(); restriction.setBaseTypeName(Constants.XSD_STRING); simple.setContent(restriction); Object[] constants = getTypeClass().getEnumConstants(); List<XmlSchemaFacet> facets = restriction.getFacets(); for (Object constant : constants) { XmlSchemaEnumerationFacet f = new XmlSchemaEnumerationFacet(); f.setValue(getValue(constant)); facets.add(f); } }
@Override public void writeSchema(XmlSchema root) { XmlSchemaSimpleType simple = new XmlSchemaSimpleType(root, true); simple.setName(getSchemaType().getLocalPart()); XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction(); restriction.setBaseTypeName(Constants.XSD_STRING); simple.setContent(restriction); Object[] constants = getTypeClass().getEnumConstants(); List<XmlSchemaFacet> facets = restriction.getFacets(); for (Object constant : constants) { XmlSchemaEnumerationFacet f = new XmlSchemaEnumerationFacet(); f.setValue(getValue(constant)); facets.add(f); } }
XmlSchemaSimpleType simpleType = new XmlSchemaSimpleType(xmlSchema, false); simpleType.setName(enumClass); XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction(); restriction.setBaseTypeName(Constants.XSD_STRING); List enumList = Arrays.asList(classType.getEnumConstants());
XmlSchemaSimpleType simpleType = new XmlSchemaSimpleType(xmlSchema, false); simpleType.setName(enumClass); XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction(); restriction.setBaseTypeName(Constants.XSD_STRING); List enumList = Arrays.asList(classType.getEnumConstants());
@Nonnull protected XmlSchemaType createNumberSchemaType(NumberResolvedType numberTypeDefinition, QName baseType) { final XmlSchemaSimpleType simpleType = new XmlSchemaSimpleType(schema, false); final XmlSchemaSimpleTypeRestriction content = new XmlSchemaSimpleTypeRestriction(); content.setBaseTypeName(baseType); if (numberTypeDefinition.getMinimum() != null) { final XmlSchemaMinInclusiveFacet minLength = new XmlSchemaMinInclusiveFacet(); minLength.setValue(numberTypeDefinition.getMinimum()); content.getFacets().add(minLength); } if (numberTypeDefinition.getMaximum() != null) { final XmlSchemaMaxInclusiveFacet maxLength = new XmlSchemaMaxInclusiveFacet(); maxLength.setValue(numberTypeDefinition.getMaximum()); content.getFacets().add(maxLength); } simpleType.setContent(content); return simpleType; }
@Nonnull protected XmlSchemaType createNumberSchemaType(NumberResolvedType numberTypeDefinition, QName baseType) { final XmlSchemaSimpleType simpleType = new XmlSchemaSimpleType(schema, false); final XmlSchemaSimpleTypeRestriction content = new XmlSchemaSimpleTypeRestriction(); content.setBaseTypeName(baseType); if (numberTypeDefinition.getMinimum() != null) { final XmlSchemaMinInclusiveFacet minLength = new XmlSchemaMinInclusiveFacet(); minLength.setValue(numberTypeDefinition.getMinimum()); content.getFacets().add(minLength); } if (numberTypeDefinition.getMaximum() != null) { final XmlSchemaMaxInclusiveFacet maxLength = new XmlSchemaMaxInclusiveFacet(); maxLength.setValue(numberTypeDefinition.getMaximum()); content.getFacets().add(maxLength); } simpleType.setContent(content); return simpleType; }
XmlSchema.SCHEMA_NS, "restriction")) != null) { XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction();
XmlSchema.SCHEMA_NS, "restriction")) != null) { XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction();
XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction(); restriction.setBaseTypeName(Constants.XSD_STRING); XmlSchemaMaxLengthFacet maxLengthFacet = new XmlSchemaMaxLengthFacet();
final XmlSchemaSimpleTypeRestriction content = new XmlSchemaSimpleTypeRestriction(); content.setBaseTypeName(Constants.XSD_STRING); if (stringTypeDefinition.getMinLength() != null)
final XmlSchemaSimpleTypeRestriction content = new XmlSchemaSimpleTypeRestriction(); content.setBaseTypeName(Constants.XSD_STRING); if (stringTypeDefinition.getMinLength() != null)
XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction(); restriction.setBaseTypeName(Constants.XSD_STRING); XmlSchemaMaxLengthFacet maxLengthFacet = new XmlSchemaMaxLengthFacet();
XmlSchemaSimpleTypeRestriction fixedRestriction = new XmlSchemaSimpleTypeRestriction(); fixedRestriction.setBaseTypeName(Constants.XSD_DECIMAL); XmlSchemaTotalDigitsFacet fixedTotalDigits = new XmlSchemaTotalDigitsFacet();
enumSchemaSimpleType.setName(mapper.mapToQName(enumNameScope)); XmlSchemaSimpleTypeRestriction enumSchemaSimpleTypeRestriction = new XmlSchemaSimpleTypeRestriction(); enumSchemaSimpleTypeRestriction.setBaseTypeName(Constants.XSD_STRING);