public Builder(MapAttributeDefinition basis) { super(basis); this.elementValidator = basis.getElementValidator(); if (elementValidator instanceof NillableOrExpressionParameterValidator) { this.allowNullElement = ((NillableOrExpressionParameterValidator) elementValidator).getAllowNull(); } }
public Builder(MapAttributeDefinition basis) { super(basis); this.elementValidator = basis.getElementValidator(); if (elementValidator instanceof NillableOrExpressionParameterValidator) { this.allowNullElement = ((NillableOrExpressionParameterValidator) elementValidator).getAllowNull(); } }
public Builder(MapAttributeDefinition basis) { super(basis); this.elementValidator = basis.getElementValidator(); if (elementValidator instanceof NillableOrExpressionParameterValidator) { this.allowNullElement = ((NillableOrExpressionParameterValidator) elementValidator).getAllowNull(); } }
private static ParameterValidator wrapValidator(ParameterValidator toWrap, boolean allowNull, boolean validateNull, boolean allowExpression, ModelType type) { NillableOrExpressionParameterValidator result = null; if (toWrap == null) { if (type == ModelType.STRING) { toWrap = new StringLengthValidator(1, Integer.MAX_VALUE, allowNull, allowExpression); } else { toWrap = new ModelTypeValidator(type); } } else if (toWrap instanceof NillableOrExpressionParameterValidator) { // Avoid re-wrapping NillableOrExpressionParameterValidator current = (NillableOrExpressionParameterValidator) toWrap; if (allowExpression == current.isAllowExpression() && (!validateNull && current.getAllowNull() == null || allowNull == current.getAllowNull())) { result = current; } else { toWrap = current.getDelegate(); } } if (result == null) { Boolean nullCheck = validateNull ? allowNull : null; result = new NillableOrExpressionParameterValidator(toWrap, nullCheck, allowExpression); } return result; }
/** * Gets the validator to use for validating list elements. En * @return the validator, or {@code null} if no validator has been set */ public ParameterValidator getElementValidator() { if (elementValidator == null) { return null; } ParameterValidator toWrap = elementValidator; ParameterValidator wrappedElementValidator = null; if (elementValidator instanceof NillableOrExpressionParameterValidator) { // See if it's configured correctly already; if so don't re-wrap NillableOrExpressionParameterValidator wrapped = (NillableOrExpressionParameterValidator) elementValidator; Boolean allow = wrapped.getAllowNull(); if ((allow == null || allow) == getAllowNullElement() && wrapped.isAllowExpression() == isAllowExpression()) { wrappedElementValidator = wrapped; } else { // re-wrap toWrap = wrapped.getDelegate(); } } if (wrappedElementValidator == null) { elementValidator = new NillableOrExpressionParameterValidator(toWrap, getAllowNullElement(), isAllowExpression()); } return elementValidator; }
nullOK == current.getAllowNull()) { result = current; } else {
/** * Gets the validator to use for validating list elements. En * @return the validator, or {@code null} if no validator has been set */ @SuppressWarnings("WeakerAccess") public ParameterValidator getElementValidator() { if (elementValidator == null) { return null; } ParameterValidator toWrap = elementValidator; ParameterValidator wrappedElementValidator = null; if (elementValidator instanceof NillableOrExpressionParameterValidator) { // See if it's configured correctly already; if so don't re-wrap NillableOrExpressionParameterValidator wrapped = (NillableOrExpressionParameterValidator) elementValidator; Boolean allow = wrapped.getAllowNull(); if ((allow == null || allow) == getAllowNullElement() && wrapped.isAllowExpression() == isAllowExpression()) { wrappedElementValidator = wrapped; } else { // re-wrap toWrap = wrapped.getDelegate(); } } if (wrappedElementValidator == null) { elementValidator = new NillableOrExpressionParameterValidator(toWrap, getAllowNullElement(), isAllowExpression()); } return elementValidator; }
/** * Gets the validator to use for validating list elements. En * @return the validator, or {@code null} if no validator has been set */ public ParameterValidator getElementValidator() { if (elementValidator == null) { return null; } ParameterValidator toWrap = elementValidator; ParameterValidator wrappedElementValidator = null; if (elementValidator instanceof NillableOrExpressionParameterValidator) { // See if it's configured correctly already; if so don't re-wrap NillableOrExpressionParameterValidator wrapped = (NillableOrExpressionParameterValidator) elementValidator; Boolean allow = wrapped.getAllowNull(); if ((allow == null || allow) == getAllowNullElement() && wrapped.isAllowExpression() == isAllowExpression()) { wrappedElementValidator = wrapped; } else { // re-wrap toWrap = wrapped.getDelegate(); } } if (wrappedElementValidator == null) { elementValidator = new NillableOrExpressionParameterValidator(toWrap, getAllowNullElement(), isAllowExpression()); } return elementValidator; }
nullOK == current.getAllowNull()) { result = current; } else {
/** * Gets the validator to use for validating list elements. En * @return the validator, or {@code null} if no validator has been set */ public ParameterValidator getElementValidator() { if (elementValidator == null) { return null; } ParameterValidator toWrap = elementValidator; ParameterValidator wrappedElementValidator = null; if (elementValidator instanceof NillableOrExpressionParameterValidator) { // See if it's configured correctly already; if so don't re-wrap NillableOrExpressionParameterValidator wrapped = (NillableOrExpressionParameterValidator) elementValidator; Boolean allow = wrapped.getAllowNull(); if ((allow == null || allow) == getAllowNullElement() && wrapped.isAllowExpression() == isAllowExpression()) { wrappedElementValidator = wrapped; } else { // re-wrap toWrap = wrapped.getDelegate(); } } if (wrappedElementValidator == null) { elementValidator = new NillableOrExpressionParameterValidator(toWrap, getAllowNullElement(), isAllowExpression()); } return elementValidator; }
/** * Gets the validator to use for validating list elements. En * @return the validator, or {@code null} if no validator has been set */ @SuppressWarnings("WeakerAccess") public ParameterValidator getElementValidator() { if (elementValidator == null) { return null; } ParameterValidator toWrap = elementValidator; ParameterValidator wrappedElementValidator = null; if (elementValidator instanceof NillableOrExpressionParameterValidator) { // See if it's configured correctly already; if so don't re-wrap NillableOrExpressionParameterValidator wrapped = (NillableOrExpressionParameterValidator) elementValidator; Boolean allow = wrapped.getAllowNull(); if ((allow == null || allow) == getAllowNullElement() && wrapped.isAllowExpression() == isAllowExpression()) { wrappedElementValidator = wrapped; } else { // re-wrap toWrap = wrapped.getDelegate(); } } if (wrappedElementValidator == null) { elementValidator = new NillableOrExpressionParameterValidator(toWrap, getAllowNullElement(), isAllowExpression()); } return elementValidator; }
/** * Gets the validator to use for validating list elements. En * @return the validator, or {@code null} if no validator has been set */ public ParameterValidator getElementValidator() { if (elementValidator == null) { return null; } ParameterValidator toWrap = elementValidator; ParameterValidator wrappedElementValidator = null; if (elementValidator instanceof NillableOrExpressionParameterValidator) { // See if it's configured correctly already; if so don't re-wrap NillableOrExpressionParameterValidator wrapped = (NillableOrExpressionParameterValidator) elementValidator; Boolean allow = wrapped.getAllowNull(); if ((allow == null || allow) == getAllowNullElement() && wrapped.isAllowExpression() == isAllowExpression()) { wrappedElementValidator = wrapped; } else { // re-wrap toWrap = wrapped.getDelegate(); } } if (wrappedElementValidator == null) { elementValidator = new NillableOrExpressionParameterValidator(toWrap, getAllowNullElement(), isAllowExpression()); } return elementValidator; }