+
+ public boolean validateValueType(String propertyType) throws ConstraintValueDoNotMatchPropertyTypeException {
+ ToscaType toscaType = ToscaType.getToscaType(propertyType);
+ if (toscaType == null) {
+ throw new ConstraintValueDoNotMatchPropertyTypeException(
+ "inRange constraint has invalid values <" + inRange + "> property type is <" + propertyType + ">");
+ }
+ if (inRange == null) {
+ throw new ConstraintValueDoNotMatchPropertyTypeException(
+ "inRange constraint has invalid value <> property type is <" + propertyType + ">");
+ }
+ for (Object value : inRange) {
+ if (!toscaType.isValueTypeValid(value)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public void changeConstraintValueTypeTo(String propertyType) throws ConstraintValueDoNotMatchPropertyTypeException {
+ ToscaType toscaType = ToscaType.getToscaType(propertyType);
+ try {
+ inRange.replaceAll(obj -> toscaType.convert(String.valueOf(obj)));
+ } catch (Exception e) {
+ throw new ConstraintValueDoNotMatchPropertyTypeException(
+ "inRange constraint has invalid values <" + inRange + "> property type is <" + propertyType + ">");
+ }
+ }