Javadoc
Fixed javadoc errors and warnings
This commit is contained in:
committed by
Michael Minella
parent
3cdce1f9ef
commit
b945428eaf
@@ -87,12 +87,38 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.5.1</version>
|
||||
<version>3.2</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.10.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
@@ -27,9 +27,6 @@ import org.springframework.core.io.Resource;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* {@link org.springframework.batch.item.ItemReader} implementation to read an Excel
|
||||
* file. It will read the file sheet for sheet and row for row. It is loosy based on
|
||||
@@ -45,7 +42,6 @@ public abstract class AbstractExcelItemReader<T> extends AbstractItemCountingIte
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
private Resource resource;
|
||||
private int linesToSkip = 0;
|
||||
private int currentRow = 0;
|
||||
private int currentSheet = 0;
|
||||
private RowMapper<T> rowMapper;
|
||||
private RowCallbackHandler skippedRowsCallback;
|
||||
@@ -59,6 +55,10 @@ public abstract class AbstractExcelItemReader<T> extends AbstractItemCountingIte
|
||||
this.setName(ClassUtils.getShortName(this.getClass()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string corresponding to logical record according to
|
||||
* {@link #setRowMapper(RowMapper)} (might span multiple rows in file).
|
||||
*/
|
||||
@Override
|
||||
protected T doRead() throws Exception {
|
||||
if (this.noInput || this.rs == null) {
|
||||
@@ -136,6 +136,11 @@ public abstract class AbstractExcelItemReader<T> extends AbstractItemCountingIte
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the input resource.
|
||||
*
|
||||
* @param resource the {@code Resource} pointing to the Excelfile
|
||||
*/
|
||||
public void setResource(final Resource resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
@@ -148,16 +153,31 @@ public abstract class AbstractExcelItemReader<T> extends AbstractItemCountingIte
|
||||
* Set the number of lines to skip. This number is applied to all worksheet
|
||||
* in the excel file! default to 0
|
||||
*
|
||||
* @param linesToSkip
|
||||
* @param linesToSkip number of lines to skip
|
||||
*/
|
||||
public void setLinesToSkip(final int linesToSkip) {
|
||||
this.linesToSkip = linesToSkip;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param sheet the sheet index
|
||||
* @return the sheet or <code>null</code> when no sheet available.
|
||||
*/
|
||||
protected abstract Sheet getSheet(int sheet);
|
||||
|
||||
/**
|
||||
* The number of sheets in the underlying workbook.
|
||||
*
|
||||
* @return the number of sheets.
|
||||
*/
|
||||
protected abstract int getNumberOfSheets();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param resource {@code Resource} pointing to the Excel file to read
|
||||
* @throws Exception when the Excel sheet cannot be accessed
|
||||
*/
|
||||
protected abstract void openExcelFile(Resource resource) throws Exception;
|
||||
|
||||
/**
|
||||
@@ -170,14 +190,28 @@ public abstract class AbstractExcelItemReader<T> extends AbstractItemCountingIte
|
||||
this.strict = strict;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the {@code rowMapper}. Used to map a row read from the underlying Excel workbook.
|
||||
*
|
||||
* @param rowMapper the {@code RowMapper} to use.
|
||||
*/
|
||||
public void setRowMapper(final RowMapper<T> rowMapper) {
|
||||
this.rowMapper = rowMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the <code>rowSetFactory</code>. Used to create a {@code RowSet} implemenation. By default the
|
||||
* {@code DefaultRowSetFactory} is used.
|
||||
*
|
||||
* @param rowSetFactory the {@code RowSetFactory} to use.
|
||||
*/
|
||||
public void setRowSetFactory(RowSetFactory rowSetFactory) {
|
||||
this.rowSetFactory = rowSetFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param skippedRowsCallback will be called for each one of the initial skipped lines before any items are read.
|
||||
*/
|
||||
public void setSkippedRowsCallback(final RowCallbackHandler skippedRowsCallback) {
|
||||
this.skippedRowsCallback = skippedRowsCallback;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2014 the original author or authors.
|
||||
* Copyright 2006-2015 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.
|
||||
@@ -20,7 +20,7 @@ import org.springframework.batch.item.excel.support.rowset.RowSet;
|
||||
/**
|
||||
* Map rows from an excel sheet to an object.
|
||||
*
|
||||
* @param <T>
|
||||
* @param <T> the type
|
||||
* @author Marten Deinum
|
||||
* @since 0.5.0
|
||||
*/
|
||||
|
||||
@@ -58,6 +58,7 @@ import java.util.Set;
|
||||
* For best performance, consider using a custom {@link RowMapper} implementation.
|
||||
*
|
||||
* @author Marten Deinum
|
||||
* @param <T> The type
|
||||
* @since 0.5.0
|
||||
*/
|
||||
public class BeanPropertyRowMapper<T> implements RowMapper<T>, BeanFactoryAware, InitializingBean {
|
||||
@@ -115,7 +116,7 @@ public class BeanPropertyRowMapper<T> implements RowMapper<T>, BeanFactoryAware,
|
||||
* that will be passed into {@link #mapRow(RowSet)}. Typically a
|
||||
* prototype scoped bean so that a new instance is returned for each field
|
||||
* set mapped.
|
||||
* <p/>
|
||||
*
|
||||
* Either this property or the type property must be specified, but not
|
||||
* both.
|
||||
*
|
||||
@@ -129,7 +130,7 @@ public class BeanPropertyRowMapper<T> implements RowMapper<T>, BeanFactoryAware,
|
||||
* Public setter for the type of bean to create instead of using a prototype
|
||||
* bean. An object of this type will be created from its default constructor
|
||||
* for every call to {@link #mapRow(RowSet)}.<br>
|
||||
* <p/>
|
||||
*
|
||||
* Either this property or the prototype bean name must be specified, but
|
||||
* not both.
|
||||
*
|
||||
@@ -187,9 +188,10 @@ public class BeanPropertyRowMapper<T> implements RowMapper<T>, BeanFactoryAware,
|
||||
|
||||
/**
|
||||
* Set whether we're strictly validating that all bean properties have been
|
||||
* mapped from corresponding database fields.
|
||||
* <p>Default is {@code false}, accepting unpopulated properties in the
|
||||
* target bean.
|
||||
* mapped from corresponding database fields. Default is {@code false},
|
||||
* accepting unpopulated properties in the target bean.
|
||||
*
|
||||
* @param checkFullyPopulated true or false
|
||||
*/
|
||||
public void setCheckFullyPopulated(boolean checkFullyPopulated) {
|
||||
this.checkFullyPopulated = checkFullyPopulated;
|
||||
@@ -198,6 +200,8 @@ public class BeanPropertyRowMapper<T> implements RowMapper<T>, BeanFactoryAware,
|
||||
/**
|
||||
* Return whether we're strictly validating that all bean properties have been
|
||||
* mapped from corresponding database fields.
|
||||
*
|
||||
* @return true when resulting bean should be checked
|
||||
*/
|
||||
public boolean isCheckFullyPopulated() {
|
||||
return this.checkFullyPopulated;
|
||||
@@ -206,7 +210,10 @@ public class BeanPropertyRowMapper<T> implements RowMapper<T>, BeanFactoryAware,
|
||||
/**
|
||||
* Set whether we're defaulting Java primitives in the case of mapping a null value
|
||||
* from corresponding database fields.
|
||||
* <p>Default is {@code false}, throwing an exception when nulls are mapped to Java primitives.
|
||||
*
|
||||
* Default is {@code false}, throwing an exception when nulls are mapped to Java primitives.
|
||||
*
|
||||
* @param primitivesDefaultedForNullValue should default values be used when read value is {@code null}
|
||||
*/
|
||||
public void setPrimitivesDefaultedForNullValue(boolean primitivesDefaultedForNullValue) {
|
||||
this.primitivesDefaultedForNullValue = primitivesDefaultedForNullValue;
|
||||
@@ -215,6 +222,8 @@ public class BeanPropertyRowMapper<T> implements RowMapper<T>, BeanFactoryAware,
|
||||
/**
|
||||
* Return whether we're defaulting Java primitives in the case of mapping a null value
|
||||
* from corresponding database fields.
|
||||
*
|
||||
* @return {@code true} when default values be used when read value is {@code null}
|
||||
*/
|
||||
public boolean isPrimitivesDefaultedForNullValue() {
|
||||
return primitivesDefaultedForNullValue;
|
||||
@@ -222,7 +231,8 @@ public class BeanPropertyRowMapper<T> implements RowMapper<T>, BeanFactoryAware,
|
||||
|
||||
/**
|
||||
* Extract the values for all columns in the current row.
|
||||
* <p>Utilizes public setters and result set metadata.
|
||||
*
|
||||
* Utilizes public setters and result set metadata.
|
||||
*
|
||||
* @see java.sql.ResultSetMetaData
|
||||
*/
|
||||
@@ -314,6 +324,8 @@ public class BeanPropertyRowMapper<T> implements RowMapper<T>, BeanFactoryAware,
|
||||
* (with the mapped class specified only once).
|
||||
*
|
||||
* @param targetType the class that each row should be mapped to
|
||||
* @param <T> the targetType
|
||||
* @return the newly created instance
|
||||
*/
|
||||
public static <T> BeanPropertyRowMapper<T> newInstance(Class<T> targetType) {
|
||||
BeanPropertyRowMapper<T> newInstance = new BeanPropertyRowMapper<T>();
|
||||
|
||||
@@ -72,7 +72,7 @@ public class PoiItemReader<T> extends AbstractExcelItemReader<T> {
|
||||
* it can be closed cleanly on the end of reading the file. This to be able to release the resources used by
|
||||
* Apache POI.
|
||||
*
|
||||
* @param resource
|
||||
* @param resource the {@code Resource} pointing to the Excel file.
|
||||
* @throws Exception is thrown for any errors.
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2014 the original author or authors.
|
||||
* Copyright 2006-2015 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.
|
||||
@@ -18,7 +18,7 @@ package org.springframework.batch.item.excel.support.rowset;
|
||||
import org.springframework.batch.item.excel.Sheet;
|
||||
|
||||
/**
|
||||
* Contract for extracting column names for a given {@Sheet sheet}.
|
||||
* Contract for extracting column names for a given {@code sheet}.
|
||||
*
|
||||
* @author Marten Deinum
|
||||
* @since 0.5.0
|
||||
|
||||
@@ -37,4 +37,9 @@ public class MockExcelItemReader<T> extends AbstractExcelItemReader<T> {
|
||||
protected void openExcelFile(Resource resource) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doClose() throws Exception {
|
||||
sheets.clear();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user