@Test(expected = NullPointerException.class) public void testExecuteCellProcessorsWithNullProcessors() { Util.executeCellProcessors(new ArrayList<Object>(), LIST, null, LINE_NO, ROW_NO); }
public static void executeCellProcessors(final List<Object> destination, final List<?> source, final CellProcessor[] processors, final int lineNo, final int rowNo) { if( destination == null ) { throw new NullPointerException("destination should not be null"); } else if( source == null ) { throw new NullPointerException("source should not be null"); } else if( processors == null ) { throw new NullPointerException("processors should not be null"); } final CsvContext context = new CsvContext(lineNo, rowNo, 1); context.setRowSource(new ArrayList<Object>(source)); if( source.size() != processors.length ) { throw new SuperCsvException(String.format( "The number of columns to be processed (%d) must match the number of CellProcessors (%d): check that the number" + " of CellProcessors you have defined matches the expected number of columns being read/written", source.size(), processors.length), context); } destination.clear(); for( int i = 0; i < source.size(); i++ ) { context.setColumnNumber(i + 1); if( processors[i] == null ) { destination.add(source.get(i)); } else { destination.add(processors[i].execute(source.get(i), context)); } } }
Util { public static void executeCellProcessors(final List<Object> destination, final List<?> source, final CellProcessor[] processors, final int lineNo, final int rowNo) { if( destination == null ) { throw new NullPointerException("destination should not be null"); } else if( source == null ) { throw new NullPointerException("source should not be null"); } else if( processors == null ) { throw new NullPointerException("processors should not be null"); } final CsvContext context = new CsvContext(lineNo, rowNo, 1); context.setRowSource(new ArrayList<Object>(source)); if( source.size() != processors.length ) { throw new SuperCsvException(String.format( "The number of columns to be processed (%d) must match the number of CellProcessors (%d): check that the number" + " of CellProcessors you have defined matches the expected number of columns being read/written", source.size(), processors.length), context); } destination.clear(); for( int i = 0; i < source.size(); i++ ) { context.setColumnNumber(i + 1); if( processors[i] == null ) { destination.add(source.get(i)); } else { destination.add(processors[i].execute(source.get(i), context)); } } } }
Util { public static void executeCellProcessors(final List<Object> destination, final List<?> source, final CellProcessor[] processors, final int lineNo, final int rowNo) { if( destination == null ) { throw new NullPointerException("destination should not be null"); } else if( source == null ) { throw new NullPointerException("source should not be null"); } else if( processors == null ) { throw new NullPointerException("processors should not be null"); } final CsvContext context = new CsvContext(lineNo, rowNo, 1); context.setRowSource(new ArrayList<Object>(source)); if( source.size() != processors.length ) { throw new SuperCsvException(String.format( "The number of columns to be processed (%d) must match the number of CellProcessors (%d): check that the number" + " of CellProcessors you have defined matches the expected number of columns being read/written", source.size(), processors.length), context); } destination.clear(); for( int i = 0; i < source.size(); i++ ) { context.setColumnNumber(i + 1); if( processors[i] == null ) { destination.add(source.get(i)); } else { destination.add(processors[i].execute(source.get(i), context)); } } } private  Util(); }
Util { public static void executeCellProcessors(final List<Object> destination, final List<?> source, final CellProcessor[] processors, final int lineNo, final int rowNo) { if( destination == null ) { throw new NullPointerException("destination should not be null"); } else if( source == null ) { throw new NullPointerException("source should not be null"); } else if( processors == null ) { throw new NullPointerException("processors should not be null"); } final CsvContext context = new CsvContext(lineNo, rowNo, 1); context.setRowSource(new ArrayList<Object>(source)); if( source.size() != processors.length ) { throw new SuperCsvException(String.format( "The number of columns to be processed (%d) must match the number of CellProcessors (%d): check that the number" + " of CellProcessors you have defined matches the expected number of columns being read/written", source.size(), processors.length), context); } destination.clear(); for( int i = 0; i < source.size(); i++ ) { context.setColumnNumber(i + 1); if( processors[i] == null ) { destination.add(source.get(i)); } else { destination.add(processors[i].execute(source.get(i), context)); } } } private  Util(); static void executeCellProcessors(final List<Object> destination, final List<?> source,
		final CellProcessor[] processors, final int lineNo, final int rowNo); static void filterListToMap(final Map<String, T> destinationMap, final String[] nameMapping,
		final List<? extends T> sourceList); static List<Object> filterMapToList(final Map<String, ?> map, final String[] nameMapping); static Object[] filterMapToObjectArray(final Map<String, ?> values, final String[] nameMapping); static String[] objectArrayToStringArray(final Object[] objectArray); static String[] objectListToStringArray(final List<?> objectList); static String subtractBom(String line); }
Util { public static void executeCellProcessors(final List<Object> destination, final List<?> source, final CellProcessor[] processors, final int lineNo, final int rowNo) { if( destination == null ) { throw new NullPointerException("destination should not be null"); } else if( source == null ) { throw new NullPointerException("source should not be null"); } else if( processors == null ) { throw new NullPointerException("processors should not be null"); } final CsvContext context = new CsvContext(lineNo, rowNo, 1); context.setRowSource(new ArrayList<Object>(source)); if( source.size() != processors.length ) { throw new SuperCsvException(String.format( "The number of columns to be processed (%d) must match the number of CellProcessors (%d): check that the number" + " of CellProcessors you have defined matches the expected number of columns being read/written", source.size(), processors.length), context); } destination.clear(); for( int i = 0; i < source.size(); i++ ) { context.setColumnNumber(i + 1); if( processors[i] == null ) { destination.add(source.get(i)); } else { destination.add(processors[i].execute(source.get(i), context)); } } } private  Util(); static void executeCellProcessors(final List<Object> destination, final List<?> source,
		final CellProcessor[] processors, final int lineNo, final int rowNo); static void filterListToMap(final Map<String, T> destinationMap, final String[] nameMapping,
		final List<? extends T> sourceList); static List<Object> filterMapToList(final Map<String, ?> map, final String[] nameMapping); static Object[] filterMapToObjectArray(final Map<String, ?> values, final String[] nameMapping); static String[] objectArrayToStringArray(final Object[] objectArray); static String[] objectListToStringArray(final List<?> objectList); static String subtractBom(String line);  }