private void validateBooleanField () throws ComponentConfigException { UIFieldType[] booleanTypes = {UIFieldType.BOOLEAN, UIFieldType.ARRAYBOOLEAN}; if (!Arrays.asList(booleanTypes).contains(type)) { return; } if (fields != null) { logAndThrowException(String.format(NOT_APPLICABLE_PROPERTY, FIELDS, fieldName, type)); } if (options != null) { logAndThrowException(String.format(NOT_APPLICABLE_PROPERTY, OPTIONS, fieldName, type)); } if (defaultValue != null) { // defaultValue for array.boolean not applicable. if (UIFieldType.ARRAYBOOLEAN.equals(type)) { logAndThrowException(String.format(NOT_APPLICABLE_PROPERTY, DEFAULT_VALUE, fieldName, type)); } if (!(defaultValue instanceof Boolean)) { logAndThrowException(String.format(DEFAULT_VALUE_TYPE, fieldName, type, Boolean.class.getCanonicalName(), defaultValue.getClass().getCanonicalName())); } } }
private void validateNumberField () throws ComponentConfigException { UIFieldType[] numberTypes = {UIFieldType.NUMBER, UIFieldType.ARRAYNUMBER}; if (!Arrays.asList(numberTypes).contains(this.type)) { return; } if (fields != null) { logAndThrowException(String.format(NOT_APPLICABLE_PROPERTY, FIELDS, fieldName, type)); } if (options != null) { logAndThrowException(String.format(NOT_APPLICABLE_PROPERTY, OPTIONS, fieldName, type)); } if (defaultValue != null) { //defaultValue not supported for array types if (type.equals(UIFieldType.ARRAYNUMBER)) { logAndThrowException(String.format(NOT_APPLICABLE_PROPERTY, DEFAULT_VALUE, fieldName, type)); } //jackson deserializes a json number in to one of the below depending on the size and if its not an integer. Hence this validation if (!((defaultValue instanceof Integer) || (defaultValue instanceof Long) || (defaultValue instanceof Double))) { logAndThrowException(String.format(DEFAULT_VALUE_TYPE, fieldName, type, " number ", defaultValue.getClass().getCanonicalName())); } } }
logAndThrowException(String.format(NOT_APPLICABLE_PROPERTY, FIELDS, fieldName, type)); if (type.equals(UIFieldType.ENUMSTRING) || type.equals(UIFieldType.ARRAYENUMSTRING)) { if (type.equals(UIFieldType.ARRAYSTRING) || type.equals(UIFieldType.ARRAYENUMSTRING)) { .getCanonicalName())); if (UIFieldType.ENUMSTRING.equals(type)) {
return; if (type.equals(UIFieldType.OBJECT) || type.equals(UIFieldType.ARRAYOBJECT)) { if (!UIFieldType.OBJECT.equals(optionObject.type)) { logAndThrowException(String.format("option %s for field %s of type %s is expected to be of type %s Actual: %s", optionObject, fieldName, type, UIFieldType.OBJECT, optionObject.type)); if (type.equals(UIFieldType.ARRAYENUMOBJECT)) { logAndThrowException(String.format(NOT_APPLICABLE_PROPERTY, DEFAULT_VALUE, fieldName, type)); } else if (!optionKeys.contains(defaultValue)) {
.filter(uiField -> uiField.getType().equals(ComponentUISpecification.UIFieldType.FILE)) .map(uiField -> uiField.getFieldName()) .collect(toList());