/** * Utility to check if a string is present in a list of strings. If the string is null then do nothing. * * @param isNullable if the value is allowed to be null or not. * @param validationContext The context of the item in the class being validated. This is used in case of an error. * @param value string to look for. * @param acceptableValues list of strings to look in. * @return returns an error if string is not present in list. Otherwise returns an empty list. */ protected static List<RaveError> checkStringDef( boolean isNullable, ValidationContext validationContext, @Nullable String value, String... acceptableValues) { List<RaveError> errors = checkNullable(value, isNullable, validationContext); if (value == null) { return errors; } for (String string : acceptableValues) { if (value.equals(string)) { return Collections.<RaveError>emptyList(); } } return createStringDefError(value, acceptableValues, validationContext); }