BATCH-1906: Fixed documentation and whitespace

This commit is contained in:
Michael Minella
2013-03-04 18:08:37 -06:00
parent 6e7b290727
commit c993e4c4e7
4 changed files with 104 additions and 86 deletions

View File

@@ -1,3 +1,18 @@
/*
* Copyright 20013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.item;
import org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader;
@@ -9,7 +24,11 @@ import org.springframework.batch.item.support.AbstractItemCountingItemStreamItem
* @author Jimmy Praet
*/
public interface ItemCountAware {
void setItemCount(int count);
/**
* Setter for the injection of the current item count.
*
* @param count the number of items that have been processed in this execution.
*/
void setItemCount(int count);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2007 the original author or authors.
* Copyright 2006-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -74,7 +74,7 @@ public abstract class AbstractItemCountingItemStreamItemReader<T> extends Abstra
}
}
@Override
@Override
public final T read() throws Exception, UnexpectedInputException, ParseException {
if (currentItemCount >= maxItemCount) {
return null;
@@ -82,8 +82,8 @@ public abstract class AbstractItemCountingItemStreamItemReader<T> extends Abstra
currentItemCount++;
T item = doRead();
if(item instanceof ItemCountAware) {
((ItemCountAware) item).setItemCount(currentItemCount);
}
((ItemCountAware) item).setItemCount(currentItemCount);
}
return item;
}
@@ -120,9 +120,9 @@ public abstract class AbstractItemCountingItemStreamItemReader<T> extends Abstra
this.maxItemCount = count;
}
@Override
@Override
public void close() throws ItemStreamException {
super.close();
super.close();
currentItemCount = 0;
try {
doClose();
@@ -132,9 +132,9 @@ public abstract class AbstractItemCountingItemStreamItemReader<T> extends Abstra
}
}
@Override
@Override
public void open(ExecutionContext executionContext) throws ItemStreamException {
super.open(executionContext);
super.open(executionContext);
try {
doOpen();
}
@@ -166,9 +166,9 @@ public abstract class AbstractItemCountingItemStreamItemReader<T> extends Abstra
}
@Override
@Override
public void update(ExecutionContext executionContext) throws ItemStreamException {
super.update(executionContext);
super.update(executionContext);
if (saveState) {
Assert.notNull(executionContext, "ExecutionContext must not be null");
executionContext.putInt(getExecutionContextKey(READ_COUNT), currentItemCount);
@@ -187,7 +187,7 @@ public abstract class AbstractItemCountingItemStreamItemReader<T> extends Abstra
* @param name the name for the component
*/
public void setName(String name) {
this.setExecutionContextName(name);
this.setExecutionContextName(name);
}
/**