/** * Checks to see if the map is null. * * @param map the map to validate. * @param isNullable is the object is allowed to be null. * @param validationContext The context of the item in the class being validated. This is used in case of an error. * @return a list of of {@link RaveError}s if the object is not allowed to be null. Returns null otherwise. This * method will also RAVE validate the keys and values of the map if they are RAVE enabled. */ protected static <K, V> List<RaveError> checkNullable( @Nullable Map<K, V> map, boolean isNullable, ValidationContext validationContext) { List<RaveError> errors = checkNullable((Object) map, isNullable, validationContext); if (map == null) { return errors; } errors = checkIterable(map.keySet(), errors); return checkIterable(map.values(), errors); }
/** * Checks to see if the object is null. * * @param collection the collection to validate. * @param isNullable is the object is allowed to be null. * @param validationContext the context of the item in the class being validated. This is used in case of an error. * @return a list of of {@link RaveError}s if the object is not allowed to be null. Returns null otherwise. */ protected static List<RaveError> checkNullable( @Nullable Collection<?> collection, boolean isNullable, ValidationContext validationContext) { List<RaveError> errors = checkNullable((Object) collection, isNullable, validationContext); return collection == null ? errors : checkIterable(collection, errors); }