Search in sources :

Example 1 with LocalSimpleType

use of org.mule.runtime.module.extension.internal.capability.xml.schema.model.LocalSimpleType in project mule by mulesoft.

the class SchemaBuilder method createExpressionAndPropertyPlaceHolderSimpleType.

private LocalSimpleType createExpressionAndPropertyPlaceHolderSimpleType() {
    LocalSimpleType expression = new LocalSimpleType();
    Restriction restriction = new Restriction();
    expression.setRestriction(restriction);
    restriction.setBase(SchemaConstants.MULE_PROPERTY_PLACEHOLDER_TYPE);
    return expression;
}
Also used : Restriction(org.mule.runtime.module.extension.internal.capability.xml.schema.model.Restriction) LocalSimpleType(org.mule.runtime.module.extension.internal.capability.xml.schema.model.LocalSimpleType)

Example 2 with LocalSimpleType

use of org.mule.runtime.module.extension.internal.capability.xml.schema.model.LocalSimpleType in project mule by mulesoft.

the class SchemaBuilder method createEnumSimpleType.

private LocalSimpleType createEnumSimpleType(MetadataType enumType) {
    LocalSimpleType enumValues = new LocalSimpleType();
    Restriction restriction = new Restriction();
    enumValues.setRestriction(restriction);
    restriction.setBase(STRING);
    EnumAnnotation<String> enumAnnotation = enumType.getAnnotation(EnumAnnotation.class).orElseThrow(() -> new IllegalArgumentException("Cannot obtain enum values for the given type"));
    for (String value : enumAnnotation.getValues()) {
        NoFixedFacet noFixedFacet = objectFactory.createNoFixedFacet();
        noFixedFacet.setValue(value);
        JAXBElement<NoFixedFacet> enumeration = objectFactory.createEnumeration(noFixedFacet);
        enumValues.getRestriction().getFacets().add(enumeration);
    }
    return enumValues;
}
Also used : Restriction(org.mule.runtime.module.extension.internal.capability.xml.schema.model.Restriction) LocalSimpleType(org.mule.runtime.module.extension.internal.capability.xml.schema.model.LocalSimpleType) EnumAnnotation(org.mule.metadata.api.annotation.EnumAnnotation) NoFixedFacet(org.mule.runtime.module.extension.internal.capability.xml.schema.model.NoFixedFacet)

Aggregations

LocalSimpleType (org.mule.runtime.module.extension.internal.capability.xml.schema.model.LocalSimpleType)2 Restriction (org.mule.runtime.module.extension.internal.capability.xml.schema.model.Restriction)2 EnumAnnotation (org.mule.metadata.api.annotation.EnumAnnotation)1 NoFixedFacet (org.mule.runtime.module.extension.internal.capability.xml.schema.model.NoFixedFacet)1