diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemReader.java index 19c93f2b5..24ffdde88 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemReader.java @@ -46,6 +46,6 @@ public interface ItemReader { * * @throws Exception if an underlying resource is unavailable. */ - T read() throws Exception, UnexpectedInputException, NoWorkFoundException, ParseException; + T read() throws Exception, UnexpectedInputException, ParseException; } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JpaPagingItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JpaPagingItemReader.java index b6251e9ca..a48082842 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JpaPagingItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JpaPagingItemReader.java @@ -43,7 +43,7 @@ import org.springframework.util.ClassUtils; * better performance. * * In order to reduce the memory usage for large results the persistence context is flushed and cleared - * after each page is read. This cuases any entities read to be detached. If you make changes to the + * after each page is read. This causes any entities read to be detached. If you make changes to the * entities and want the changes persisted then you must explicitly merge the entities. * * The reader must be configured with an {@link javax.persistence.EntityManagerFactory}. All entity access diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/LineMapper.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/LineMapper.java index 40e472df1..d970e2e85 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/LineMapper.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/LineMapper.java @@ -1,13 +1,33 @@ package org.springframework.batch.item.file.mapping; +import org.springframework.batch.item.file.FlatFileItemReader; +import org.springframework.batch.item.file.transform.LineTokenizer; + + /** - * Interface for mapping lines (strings) to domain objects. + * Interface for mapping lines (strings) to domain objects typically used by + * {@link FlatFileItemReader} to map lines read from a file to domain objects + * on a per line basis. Implementations of this interface perform the actual + * work of parsing a line without having to deal with how the line was + * obtained. * * @author Robert Kasanicky - * * @param type of the domain object + * @see FieldSetMapper + * @see LineTokenizer + * @since 2.0 */ public interface LineMapper { + /** + * Implementations must implement this method to map the provided line to + * the parameter type T. The line number represents the number of lines + * into a file the current line resides. + * + * @param line to be mapped + * @param lineNumber of the current line + * @return mapped object of type T + * @throws Exception if error occured while parsing. + */ T mapLine(String line, int lineNumber) throws Exception; } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/AbstractItemCountingItemStreamItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/AbstractItemCountingItemStreamItemReader.java index 444a88e96..ccb54d2d5 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/AbstractItemCountingItemStreamItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/AbstractItemCountingItemStreamItemReader.java @@ -4,7 +4,6 @@ import org.springframework.batch.item.ExecutionContext; import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.ItemStream; import org.springframework.batch.item.ItemStreamException; -import org.springframework.batch.item.NoWorkFoundException; import org.springframework.batch.item.ParseException; import org.springframework.batch.item.UnexpectedInputException; import org.springframework.batch.item.util.ExecutionContextUserSupport; @@ -57,7 +56,7 @@ public abstract class AbstractItemCountingItemStreamItemReader implements Ite } } - public T read() throws Exception, UnexpectedInputException, NoWorkFoundException, ParseException { + public T read() throws Exception, UnexpectedInputException, ParseException { currentItemCount++; return doRead(); }