if(argument != null && !argument.isEmpty()) throw new IllegalArgumentException("NotNull does not expect any argument but has " + argument); return new NotNull(); return new StrRegEx(argument.substring(1, argument.length() - 1)); return new Unique(); return new UniqueHashCode(); return new Strlen(requiredLengths); return new StrMinMax(Long.parseLong(splits[0]), Long.parseLong(splits[1])); return new LMinMax(Long.parseLong(args[0]), Long.parseLong(args[1])); return new DMinMax(Double.parseDouble(doubles[0]), Double.parseDouble(doubles[1])); return new Equals(); return new ForbidSubStr(forbiddenSubStrings); return new RequireSubStr(requiredSubStrings); return new StrNotNullOrEmpty(); return new RequireHashCode(hashcodes); return new IsIncludedIn(elements);
/** * Constructs a new <tt>IsElementOf</tt>, which ensures that the input value is an element of a Collection. * * @param collection * the collection to check * @throws NullPointerException * if collection is null */ public IsElementOf(final Collection<Object> collection) { super(); checkPreconditions(collection); this.collection = collection; }
/** * Get a Long Min Max cellprocessor. * * @param minValue * minimum value. * @param maxValue * maximum value. * @return CellProcessor */ private static CellProcessor addLongMinMax(Long minValue, Long maxValue) { Long min = minValue == null ? LMinMax.MIN_LONG : minValue; Long max = maxValue == null ? LMinMax.MAX_LONG : maxValue; return new LMinMax(min, max); }
/** * Constructs a new <tt>ForbidSubStr</tt> processor which ensures the input doesn't contain any of the supplied * substrings. * * @param forbiddenSubStrings * the List of forbidden substrings * @throws NullPointerException * if forbiddenSubStrings or one of its elements is null * @throws IllegalArgumentException * if forbiddenSubStrings is empty */ public ForbidSubStr(final List<String> forbiddenSubStrings) { super(); checkPreconditions(forbiddenSubStrings); checkAndAddForbiddenStrings(forbiddenSubStrings); }
/** * Get a Double Min Max cellprocessor. * * @param minValue * minimum value. * @param maxValue * maximum value. * @return CellProcessor */ private static CellProcessor addDoubleMinMax(Double minValue, Double maxValue) { Double min = minValue == null ? DMinMax.MIN_DOUBLE : minValue; Double max = maxValue == null ? DMinMax.MAX_DOUBLE : maxValue; return new DMinMax(min, max); }
/** * Constructs a new <tt>Strlen</tt> processor, which ensures that the input String has a length equal to any of the * supplied lengths. * * @param requiredLengths * one or more required lengths * @throws NullPointerException * if requiredLengths is null * @throws IllegalArgumentException * if requiredLengths is empty or contains a negative length */ public Strlen(final int... requiredLengths) { super(); checkPreconditions(requiredLengths); checkAndAddLengths(requiredLengths); }
/** * Constructs a new <tt>DMinMax</tt> processor, which converts the input to a Double and ensures the value is * between the supplied min and max values. * * @param min * the minimum value (inclusive) * @param max * the maximum value (inclusive) * @throws IllegalArgumentException * if {@code max < min} */ public DMinMax(final double min, final double max) { super(); checkPreconditions(min, max); this.min = min; this.max = max; }
/** * Constructs a new <tt>LMinMax</tt> processor, which converts the input data to a Long and and ensures the value is * between the supplied min and max values. * * @param min * the minimum value (inclusive) * @param max * the maximum value (inclusive) * @throws IllegalArgumentException * if {@code max < min} */ public LMinMax(final long min, final long max) { super(); checkPreconditions(min, max); this.min = min; this.max = max; }
/** * Constructs a new <tt>StrMinMax</tt> processor, which ensures that the input data has a string length between the * supplied min and max values (both inclusive). * * @param min * the minimum String length * @param max * the maximum String length * @throws IllegalArgumentException * if {@code max < min}, or {@code min is < 0} */ public StrMinMax(final long min, final long max) { super(); checkPreconditions(min, max); this.min = min; this.max = max; }
@Override public Object execute(Object value, CsvContext context) { Long result = (Long)super.execute(value, context); return result.intValue(); } }
/** * Converts the input to a String and ensures that the input contains at least one of the specified substrings. * * @param requiredSubStrings * the required substrings * @throws NullPointerException * if requiredSubStrings or one of its elements is null * @throws IllegalArgumentException * if requiredSubStrings is empty */ public RequireSubStr(final String... requiredSubStrings) { super(); checkPreconditions(requiredSubStrings); checkAndAddRequiredSubStrings(requiredSubStrings); }
/** * Adds each required substring, checking that it's not null. * * @param requiredSubStrings * the required substrings * @throws NullPointerException * if a required substring is null */ private void checkAndAddRequiredSubStrings(final String... requiredSubStrings) { checkAndAddRequiredSubStrings(Arrays.asList(requiredSubStrings)); }
/** * Get a Long Min Max cellprocessor. * * @param minValue * minimum value. * @param maxValue * maximum value. * @return CellProcessor */ private static CellProcessor addLongMinMax(Long minValue, Long maxValue) { Long min = minValue == null ? LMinMax.MIN_LONG : minValue; Long max = maxValue == null ? LMinMax.MAX_LONG : maxValue; return new LMinMax(min, max); }
/** * Constructs a new <tt>ForbidSubStr</tt> processor which ensures the input doesn't contain any of the supplied * substrings. * * @param forbiddenSubStrings * the forbidden substrings * @throws NullPointerException * if forbiddenSubStrings or one of its elements is null * @throws IllegalArgumentException * if forbiddenSubStrings is empty */ public ForbidSubStr(final String... forbiddenSubStrings) { super(); checkPreconditions(forbiddenSubStrings); checkAndAddForbiddenStrings(forbiddenSubStrings); }
/** * Get a Double Min Max cellprocessor. * * @param minValue * minimum value. * @param maxValue * maximum value. * @return CellProcessor */ private static CellProcessor addDoubleMinMax(Double minValue, Double maxValue) { Double min = minValue == null ? DMinMax.MIN_DOUBLE : minValue; Double max = maxValue == null ? DMinMax.MAX_DOUBLE : maxValue; return new DMinMax(min, max); }
/** * Constructs a new <tt>IsElementOf</tt>, which ensures that the input value is an element of a Collection, then * calls the next processor in the chain. * * @param collection * the collection to check * @param next * the next processor in the chain * @throws NullPointerException * if collection or next is null */ public IsElementOf(final Collection<Object> collection, final CellProcessor next) { super(next); checkPreconditions(collection); this.collection = collection; }
/** * Converts the input to a String, ensures that the input contains the specified substring, then calls the next * processor in the chain. * * @param requiredSubString * the required substring * @param next * the next processor in the chain * @throws NullPointerException * if requiredSubString or next is null */ public RequireSubStr(final String requiredSubString, final CellProcessor next) { super(next); checkPreconditions(requiredSubString); checkAndAddRequiredSubStrings(requiredSubString); }
/** * Constructs a new <tt>ForbidSubStr</tt> processor which ensures the input doesn't contain any of the supplied * substrings, then calls the next processor in the chain. * * @param forbiddenSubStrings * the List of forbidden substrings * @param next * the next processor in the chain * @throws NullPointerException * if forbiddenSubStrings, one of its elements or next is null * @throws IllegalArgumentException * if forbiddenSubStrings is empty */ public ForbidSubStr(final List<String> forbiddenSubStrings, final CellProcessor next) { super(next); checkPreconditions(forbiddenSubStrings); checkAndAddForbiddenStrings(forbiddenSubStrings); }
/** * Converts the input to a String, ensures that the input contains at least one of the specified substrings, then * calls the next processor in the chain. * * @param requiredSubStrings * the List of required substrings * @param next * the next processor in the chain * @throws NullPointerException * if requiredSubStrings, one of its elements or next is null * @throws IllegalArgumentException * if requiredSubStrings is empty */ public RequireSubStr(final List<String> requiredSubStrings, final CellProcessor next) { super(next); checkPreconditions(requiredSubStrings); checkAndAddRequiredSubStrings(requiredSubStrings); }