return new IsIncludedIn(elements);
/** * Constructs a new <tt>IsIncludedIn</tt> processor, which ensures that the input value belongs to a specific set of * given values. * * @param possibleValues * the Set of values * @throws NullPointerException * if possibleValues is null * @throws IllegalArgumentException * if possibleValues is empty */ public IsIncludedIn(final Set<Object> possibleValues) { super(); checkPreconditions(possibleValues); this.possibleValues.addAll(possibleValues); }
/** * {@inheritDoc} * * @throws SuperCsvCellProcessorException * if value is null * @throws SuperCsvConstraintViolationException * if value isn't one of the possible values */ public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if( !possibleValues.contains(value) ) { throw new SuperCsvConstraintViolationException(String.format( "'%s' is not included in the allowed set of values", value), context, this); } return next.execute(value, context); } }
/** * Constructs a new <tt>IsIncludedIn</tt> processor, which ensures that the input value belongs to a specific set of * given values. * * @param possibleValues * the array of values * @throws NullPointerException * if possibleValues is null * @throws IllegalArgumentException * if possibleValues is empty */ public IsIncludedIn(final Object[] possibleValues) { super(); checkPreconditions(possibleValues); Collections.addAll(this.possibleValues, possibleValues); }
|| headers[i].equals(InputOutputKeys.ORDERED) || headers[i].equals(InputOutputKeys.RANDOMIZE)) cellProcessors[i] = new Optional(new IsIncludedIn(truthValues));
/** * Constructs a new <tt>IsIncludedIn</tt> processor, which ensures that the input value belongs to a specific set of * given values, then calls the next processor in the chain. * * @param possibleValues * the Set of values * @param next * the next processor in the chain * @throws NullPointerException * if possibleValues or next is null * @throws IllegalArgumentException * if possibleValues is empty */ public IsIncludedIn(final Set<Object> possibleValues, final CellProcessor next) { super(next); checkPreconditions(possibleValues); this.possibleValues.addAll(possibleValues); }
return new IsIncludedIn(elements);
/** * Constructs a new <tt>IsIncludedIn</tt> processor, which ensures that the input value belongs to a specific set of * given values, then calls the next processor in the chain. * * @param possibleValues * the array of values * @param next * the next processor in the chain * @throws NullPointerException * if possibleValues or next is null * @throws IllegalArgumentException * if possibleValues is empty */ public IsIncludedIn(final Object[] possibleValues, final CellProcessor next) { super(next); checkPreconditions(possibleValues); Collections.addAll(this.possibleValues, possibleValues); }