public class FulfillmentValidationUtil extends Object
| Modifier and Type | Class and Description | 
|---|---|
| protected static interface  | FulfillmentValidationUtil.FieldValidator | 
| Constructor and Description | 
|---|
| FulfillmentValidationUtil() | 
| Modifier and Type | Method and Description | 
|---|---|
| static <T> T | getField(@NonNull org.springframework.validation.Errors errors,
        @NonNull String fieldName,
        @NonNull Class<T> clazz)Gets the value from a field casted to the requested type. | 
| static boolean | hasHint(@NonNull Collection<Object> hints,
       @NonNull String requestedHint)Tells if the specified hint is in the collection of hints. | 
| static void | rejectIfEmptyCollection(@NonNull org.springframework.validation.Errors errors,
                       @NonNull String fieldName,
                       @NonNull String errorCode)Rejects a collection value if it is empty or null. | 
| static void | rejectIfFalse(@NonNull org.springframework.validation.Errors errors,
             @NonNull String fieldName,
             @NonNull String errorCode)Rejects a value if it is non-null and false. | 
| static void | rejectIfNegative(@NonNull org.springframework.validation.Errors errors,
                @NonNull String fieldName,
                @NonNull String errorCode)Rejects a value if it is non-null and negative. | 
| static void | rejectIfNull(@NonNull org.springframework.validation.Errors errors,
            @NonNull String fieldName,
            @NonNull String errorCode)Rejects a value if it is null. | 
| static void | rejectIfTrue(@NonNull org.springframework.validation.Errors errors,
            @NonNull String fieldName,
            @NonNull String errorCode)Rejects a value if it is non-null and true. | 
| static void | validateFields(@NonNull org.springframework.validation.Errors errors,
              @NonNull Collection<String> fieldNames,
              @NonNull FulfillmentValidationUtil.FieldValidator fieldValidator,
              @NonNull String errorCodePattern)Validates multiple fields' values. | 
public static boolean hasHint(@NonNull
                              @NonNull Collection<Object> hints,
                              @NonNull
                              @NonNull String requestedHint)
hints - the collection of hints to checkrequestedHint - the hint to check if presentpublic static void rejectIfNegative(@NonNull
                                    @NonNull org.springframework.validation.Errors errors,
                                    @NonNull
                                    @NonNull String fieldName,
                                    @NonNull
                                    @NonNull String errorCode)
errors - the errors container to pull the value and add the rejection tofieldName - the name of the field to testerrorCode - the error code to add to the errorspublic static void rejectIfNull(@NonNull
                                @NonNull org.springframework.validation.Errors errors,
                                @NonNull
                                @NonNull String fieldName,
                                @NonNull
                                @NonNull String errorCode)
errors - the errors container to pull the value and add the rejection tofieldName - the name of the field to testerrorCode - the error code to add to the errorspublic static void rejectIfTrue(@NonNull
                                @NonNull org.springframework.validation.Errors errors,
                                @NonNull
                                @NonNull String fieldName,
                                @NonNull
                                @NonNull String errorCode)
errors - the errors container to pull the value and add the rejection tofieldName - the name of the field to testerrorCode - the error code to add to the errorspublic static void rejectIfFalse(@NonNull
                                 @NonNull org.springframework.validation.Errors errors,
                                 @NonNull
                                 @NonNull String fieldName,
                                 @NonNull
                                 @NonNull String errorCode)
errors - the errors container to pull the value and add the rejection tofieldName - the name of the field to testerrorCode - the error code to add to the errorspublic static void rejectIfEmptyCollection(@NonNull
                                           @NonNull org.springframework.validation.Errors errors,
                                           @NonNull
                                           @NonNull String fieldName,
                                           @NonNull
                                           @NonNull String errorCode)
errors - the errors container to pull the value and add the rejection tofieldName - the name of the field to testerrorCode - the error code to add to the errors@Nullable
public static <T> T getField(@NonNull
                                       @NonNull org.springframework.validation.Errors errors,
                                       @NonNull
                                       @NonNull String fieldName,
                                       @NonNull
                                       @NonNull Class<T> clazz)
T - the type the field value should be cast toerrors - the errors container to grab the value fromfieldName - the name of the field to fetch the value ofclazz - the class the field value should be cast topublic static void validateFields(@NonNull
                                  @NonNull org.springframework.validation.Errors errors,
                                  @NonNull
                                  @NonNull Collection<String> fieldNames,
                                  @NonNull
                                  @NonNull FulfillmentValidationUtil.FieldValidator fieldValidator,
                                  @NonNull
                                  @NonNull String errorCodePattern)
errors - the error container to pull values and add rejections tofieldNames - the names of the fields to validatefieldValidator - the validator that will validate the fields valueerrorCodePattern - the error code with a '{}' in place of the field name (see
        errorCode(String, String))Copyright © 2021. All rights reserved.