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;
}
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;
}
Aggregations