@Test public void testValidLongString() { String input = "123"; Long expected = 123L; assertEquals(expected, processor.execute(input, ANONYMOUS_CSVCONTEXT)); assertEquals(expected, processorChain.execute(input, ANONYMOUS_CSVCONTEXT)); }
public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); final Long result; if( value instanceof Long ) { result = (Long) value; } else { try { result = Long.parseLong(value.toString()); } catch(final NumberFormatException e) { throw new SuperCsvCellProcessorException(String.format("'%s' could not be parsed as a Long", value), context, this, e); } } if( result < min || result > max ) { throw new SuperCsvConstraintViolationException(String.format( "%d does not lie between the min (%d) and max (%d) values (inclusive)", result, min, max), context, this); } return next.execute(result, context); }
LMinMax extends CellProcessorAdaptor implements StringCellProcessor { public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); final Long result; if( value instanceof Long ) { result = (Long) value; } else { try { result = Long.parseLong(value.toString()); } catch(final NumberFormatException e) { throw new SuperCsvCellProcessorException(String.format("'%s' could not be parsed as a Long", value), context, this, e); } } if( result < min || result > max ) { throw new SuperCsvConstraintViolationException(String.format( "%d does not lie between the min (%d) and max (%d) values (inclusive)", result, min, max), context, this); } return next.execute(result, context); } }
LMinMax extends CellProcessorAdaptor implements StringCellProcessor { public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); final Long result; if( value instanceof Long ) { result = (Long) value; } else { try { result = Long.parseLong(value.toString()); } catch(final NumberFormatException e) { throw new SuperCsvCellProcessorException(String.format("'%s' could not be parsed as a Long", value), context, this, e); } } if( result < min || result > max ) { throw new SuperCsvConstraintViolationException(String.format( "%d does not lie between the min (%d) and max (%d) values (inclusive)", result, min, max), context, this); } return next.execute(result, context); } LMinMax(final long min, final long max);  LMinMax(final long min, final long max, final LongCellProcessor next); }
LMinMax extends CellProcessorAdaptor implements StringCellProcessor { public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); final Long result; if( value instanceof Long ) { result = (Long) value; } else { try { result = Long.parseLong(value.toString()); } catch(final NumberFormatException e) { throw new SuperCsvCellProcessorException(String.format("'%s' could not be parsed as a Long", value), context, this, e); } } if( result < min || result > max ) { throw new SuperCsvConstraintViolationException(String.format( "%d does not lie between the min (%d) and max (%d) values (inclusive)", result, min, max), context, this); } return next.execute(result, context); } LMinMax(final long min, final long max);  LMinMax(final long min, final long max, final LongCellProcessor next); Object execute(final Object value, final CsvContext context); }
LMinMax extends CellProcessorAdaptor implements StringCellProcessor { public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); final Long result; if( value instanceof Long ) { result = (Long) value; } else { try { result = Long.parseLong(value.toString()); } catch(final NumberFormatException e) { throw new SuperCsvCellProcessorException(String.format("'%s' could not be parsed as a Long", value), context, this, e); } } if( result < min || result > max ) { throw new SuperCsvConstraintViolationException(String.format( "%d does not lie between the min (%d) and max (%d) values (inclusive)", result, min, max), context, this); } return next.execute(result, context); } LMinMax(final long min, final long max);  LMinMax(final long min, final long max, final LongCellProcessor next); Object execute(final Object value, final CsvContext context); static final long MAX_LONG; static final long MIN_LONG; static final int MAX_INTEGER; static final int MIN_INTEGER; static final short MAX_SHORT; static final short MIN_SHORT; static final int MAX_CHAR; static final int MIN_CHAR; static final int MAX_8_BIT_UNSIGNED; static final int MIN_8_BIT_UNSIGNED; static final int MAX_8_BIT_SIGNED; static final int MIN_8_BIT_SIGNED; }