@Test public void mapString() { SimpleLineMapper<String> mapper = new SimpleLineMapper<String>(String.class); assertEquals("foo", mapper.mapLine("foo", 3)); }
@Override public T mapLine(String line, int lineNum) { if (line != null && this.requiredType != null && !this.requiredType.isInstance(line)) { try { return (T) convertValueToRequiredType(line, this.requiredType); } catch (IllegalArgumentException ex) { throw new TypeMismatchDataAccessException( "Type mismatch affecting line number " + lineNum + "': " + ex.getMessage()); } } return (T) line; }
SimpleLineMapper implements LineMapper<T> { @Override public T mapLine(String line, int lineNum) { if (line != null && this.requiredType != null && !this.requiredType.isInstance(line)) { try { return (T) convertValueToRequiredType(line, this.requiredType); } catch (IllegalArgumentException ex) { throw new TypeMismatchDataAccessException( "Type mismatch affecting line number " + lineNum + "': " + ex.getMessage()); } } return (T) line; } }
SimpleLineMapper implements LineMapper<T> { @Override public T mapLine(String line, int lineNum) { if (line != null && this.requiredType != null && !this.requiredType.isInstance(line)) { try { return (T) convertValueToRequiredType(line, this.requiredType); } catch (IllegalArgumentException ex) { throw new TypeMismatchDataAccessException( "Type mismatch affecting line number " + lineNum + "': " + ex.getMessage()); } } return (T) line; } SimpleLineMapper();  SimpleLineMapper(Class<T> requiredType); }
SimpleLineMapper implements LineMapper<T> { @Override public T mapLine(String line, int lineNum) { if (line != null && this.requiredType != null && !this.requiredType.isInstance(line)) { try { return (T) convertValueToRequiredType(line, this.requiredType); } catch (IllegalArgumentException ex) { throw new TypeMismatchDataAccessException( "Type mismatch affecting line number " + lineNum + "': " + ex.getMessage()); } } return (T) line; } SimpleLineMapper();  SimpleLineMapper(Class<T> requiredType); void setRequiredType(Class<T> requiredType); @Override T mapLine(String line, int lineNum); }
SimpleLineMapper implements LineMapper<T> { @Override public T mapLine(String line, int lineNum) { if (line != null && this.requiredType != null && !this.requiredType.isInstance(line)) { try { return (T) convertValueToRequiredType(line, this.requiredType); } catch (IllegalArgumentException ex) { throw new TypeMismatchDataAccessException( "Type mismatch affecting line number " + lineNum + "': " + ex.getMessage()); } } return (T) line; } SimpleLineMapper();  SimpleLineMapper(Class<T> requiredType); void setRequiredType(Class<T> requiredType); @Override T mapLine(String line, int lineNum);  }