Hopefully fix FieldSet changes (uncommitted) and add also some work in progress on JobLauncher interface change
This commit is contained in:
@@ -1,80 +1,363 @@
|
||||
/*
|
||||
* Copyright 2006-2007 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.io.file.mapping;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Date;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* Interface used by flat file input sources to encapsulate concerns of
|
||||
* converting an array of Strings to Java native types. A bit like the role
|
||||
* played by {@link ResultSet} in JDBC, clients will know the name or position
|
||||
* of strongly typed fields that they want to extract.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public interface FieldSet {
|
||||
|
||||
public String[] getNames();
|
||||
/**
|
||||
* Accessor for the names of the fields.
|
||||
*
|
||||
* @return the names
|
||||
*
|
||||
* @throws IllegalStateException if the names are not defined
|
||||
*/
|
||||
String[] getNames();
|
||||
|
||||
public String[] getValues();
|
||||
|
||||
public String readString(int index);
|
||||
|
||||
public String readString(String name);
|
||||
|
||||
public boolean readBoolean(int index);
|
||||
|
||||
public boolean readBoolean(String name);
|
||||
|
||||
public boolean readBoolean(int index, String trueValue);
|
||||
|
||||
public boolean readBoolean(String name, String trueValue);
|
||||
|
||||
public char readChar(int index);
|
||||
|
||||
public char readChar(String name);
|
||||
|
||||
public byte readByte(int index);
|
||||
|
||||
public byte readByte(String name);
|
||||
|
||||
public short readShort(int index);
|
||||
|
||||
public short readShort(String name);
|
||||
|
||||
public int readInt(int index);
|
||||
|
||||
public int readInt(String name);
|
||||
|
||||
public int readInt(int index, int defaultValue);
|
||||
|
||||
public int readInt(String name, int defaultValue);
|
||||
|
||||
public long readLong(int index);
|
||||
|
||||
public long readLong(String name);
|
||||
|
||||
public long readLong(int index, long defaultValue);
|
||||
|
||||
public long readLong(String name, long defaultValue);
|
||||
|
||||
public float readFloat(int index);
|
||||
|
||||
public float readFloat(String name);
|
||||
|
||||
public double readDouble(int index);
|
||||
|
||||
public double readDouble(String name);
|
||||
|
||||
public BigDecimal readBigDecimal(int index);
|
||||
|
||||
public BigDecimal readBigDecimal(String name);
|
||||
|
||||
public BigDecimal readBigDecimal(int index, BigDecimal defaultValue);
|
||||
|
||||
public BigDecimal readBigDecimal(String name, BigDecimal defaultValue);
|
||||
|
||||
public Date readDate(int index);
|
||||
|
||||
public Date readDate(String name);
|
||||
|
||||
public Date readDate(int index, String pattern);
|
||||
|
||||
public Date readDate(String name, String pattern);
|
||||
|
||||
public int getFieldCount();
|
||||
/**
|
||||
* @return fields wrapped by this '<code>FieldSet</code>' instance as
|
||||
* String values.
|
||||
*/
|
||||
String[] getValues();
|
||||
|
||||
public Properties getProperties();
|
||||
}
|
||||
/**
|
||||
* Read the {@link String} value at index '<code>index</code>'.
|
||||
*
|
||||
* @param index the field index.
|
||||
* @throws IndexOutOfBoundsException if the index is out of bounds.
|
||||
*/
|
||||
String readString(int index);
|
||||
|
||||
/**
|
||||
* Read the {@link String} value from column with given '<code>name</code>'.
|
||||
*
|
||||
* @param name the field name.
|
||||
*/
|
||||
String readString(String name);
|
||||
|
||||
/**
|
||||
* Read the '<code>boolean</code>' value at index '<code>index</code>'.
|
||||
*
|
||||
* @param index the field index.
|
||||
* @throws IndexOutOfBoundsException if the index is out of bounds.
|
||||
*/
|
||||
boolean readBoolean(int index);
|
||||
|
||||
/**
|
||||
* Read the '<code>boolean</code>' value from column with given '<code>name</code>'.
|
||||
*
|
||||
* @param name the field name.
|
||||
* @throws IllegalArgumentException if a column with given name is not
|
||||
* defined.
|
||||
*/
|
||||
boolean readBoolean(String name);
|
||||
|
||||
/**
|
||||
* Read the '<code>boolean</code>' value at index '<code>index</code>'.
|
||||
*
|
||||
* @param index the field index.
|
||||
* @param trueValue the value that signifies {@link Boolean#TRUE true};
|
||||
* case-sensitive.
|
||||
* @throws IndexOutOfBoundsException if the index is out of bounds, or if
|
||||
* the supplied <code>trueValue</code> is <code>null</code>.
|
||||
*/
|
||||
boolean readBoolean(int index, String trueValue);
|
||||
|
||||
/**
|
||||
* Read the '<code>boolean</code>' value from column with given '<code>name</code>'.
|
||||
*
|
||||
* @param name the field name.
|
||||
* @param trueValue the value that signifies {@link Boolean#TRUE true};
|
||||
* case-sensitive.
|
||||
* @throws IllegalArgumentException if a column with given name is not
|
||||
* defined, or if the supplied <code>trueValue</code> is <code>null</code>.
|
||||
*/
|
||||
boolean readBoolean(String name, String trueValue);
|
||||
|
||||
/**
|
||||
* Read the '<code>char</code>' value at index '<code>index</code>'.
|
||||
*
|
||||
* @param index the field index.
|
||||
* @throws IndexOutOfBoundsException if the index is out of bounds.
|
||||
*/
|
||||
char readChar(int index);
|
||||
|
||||
/**
|
||||
* Read the '<code>char</code>' value from column with given '<code>name</code>'.
|
||||
*
|
||||
* @param name the field name.
|
||||
* @throws IllegalArgumentException if a column with given name is not
|
||||
* defined.
|
||||
*/
|
||||
char readChar(String name);
|
||||
|
||||
/**
|
||||
* Read the '<code>byte</code>' value at index '<code>index</code>'.
|
||||
*
|
||||
* @param index the field index.
|
||||
* @throws IndexOutOfBoundsException if the index is out of bounds.
|
||||
*/
|
||||
byte readByte(int index);
|
||||
|
||||
/**
|
||||
* Read the '<code>byte</code>' value from column with given '<code>name</code>'.
|
||||
*
|
||||
* @param name the field name.
|
||||
*/
|
||||
byte readByte(String name);
|
||||
|
||||
/**
|
||||
* Read the '<code>short</code>' value at index '<code>index</code>'.
|
||||
*
|
||||
* @param index the field index.
|
||||
* @throws IndexOutOfBoundsException if the index is out of bounds.
|
||||
*/
|
||||
short readShort(int index);
|
||||
|
||||
/**
|
||||
* Read the '<code>short</code>' value from column with given '<code>name</code>'.
|
||||
*
|
||||
* @param name the field name.
|
||||
* @throws IllegalArgumentException if a column with given name is not
|
||||
* defined.
|
||||
*/
|
||||
short readShort(String name);
|
||||
|
||||
/**
|
||||
* Read the '<code>int</code>' value at index '<code>index</code>'.
|
||||
*
|
||||
* @param index the field index.
|
||||
* @throws IndexOutOfBoundsException if the index is out of bounds.
|
||||
*/
|
||||
int readInt(int index);
|
||||
|
||||
/**
|
||||
* Read the '<code>int</code>' value from column with given '<code>name</code>'.
|
||||
*
|
||||
* @param name the field name.
|
||||
* @throws IllegalArgumentException if a column with given name is not
|
||||
* defined.
|
||||
*/
|
||||
int readInt(String name);
|
||||
|
||||
/**
|
||||
* Read the '<code>int</code>' value at index '<code>index</code>',
|
||||
* using the supplied <code>defaultValue</code> if the field value is
|
||||
* blank.
|
||||
*
|
||||
* @param index the field index..
|
||||
* @throws IndexOutOfBoundsException if the index is out of bounds.
|
||||
*/
|
||||
int readInt(int index, int defaultValue);
|
||||
|
||||
/**
|
||||
* Read the '<code>int</code>' value from column with given '<code>name</code>',
|
||||
* using the supplied <code>defaultValue</code> if the field value is
|
||||
* blank.
|
||||
*
|
||||
* @param name the field name.
|
||||
* @throws IllegalArgumentException if a column with given name is not
|
||||
* defined.
|
||||
*/
|
||||
int readInt(String name, int defaultValue);
|
||||
|
||||
/**
|
||||
* Read the '<code>long</code>' value at index '<code>index</code>'.
|
||||
*
|
||||
* @param index the field index.
|
||||
* @throws IndexOutOfBoundsException if the index is out of bounds.
|
||||
*/
|
||||
long readLong(int index);
|
||||
|
||||
/**
|
||||
* Read the '<code>long</code>' value from column with given '<code>name</code>'.
|
||||
*
|
||||
* @param name the field name.
|
||||
* @throws IllegalArgumentException if a column with given name is not
|
||||
* defined.
|
||||
*/
|
||||
long readLong(String name);
|
||||
|
||||
/**
|
||||
* Read the '<code>long</code>' value at index '<code>index</code>',
|
||||
* using the supplied <code>defaultValue</code> if the field value is
|
||||
* blank.
|
||||
*
|
||||
* @param index the field index..
|
||||
* @throws IndexOutOfBoundsException if the index is out of bounds.
|
||||
*/
|
||||
long readLong(int index, long defaultValue);
|
||||
|
||||
/**
|
||||
* Read the '<code>long</code>' value from column with given '<code>name</code>',
|
||||
* using the supplied <code>defaultValue</code> if the field value is
|
||||
* blank.
|
||||
*
|
||||
* @param name the field name.
|
||||
* @throws IllegalArgumentException if a column with given name is not
|
||||
* defined.
|
||||
*/
|
||||
long readLong(String name, long defaultValue);
|
||||
|
||||
/**
|
||||
* Read the '<code>float</code>' value at index '<code>index</code>'.
|
||||
*
|
||||
* @param index the field index.
|
||||
* @throws IndexOutOfBoundsException if the index is out of bounds.
|
||||
*/
|
||||
float readFloat(int index);
|
||||
|
||||
/**
|
||||
* Read the '<code>float</code>' value from column with given '<code>name</code>.
|
||||
*
|
||||
* @param name the field name.
|
||||
* @throws IllegalArgumentException if a column with given name is not
|
||||
* defined.
|
||||
*/
|
||||
float readFloat(String name);
|
||||
|
||||
/**
|
||||
* Read the '<code>double</code>' value at index '<code>index</code>'.
|
||||
*
|
||||
* @param index the field index.
|
||||
* @throws IndexOutOfBoundsException if the index is out of bounds.
|
||||
*/
|
||||
double readDouble(int index);
|
||||
|
||||
/**
|
||||
* Read the '<code>double</code>' value from column with given '<code>name</code>.
|
||||
*
|
||||
* @param name the field name.
|
||||
* @throws IllegalArgumentException if a column with given name is not
|
||||
* defined.
|
||||
*/
|
||||
double readDouble(String name);
|
||||
|
||||
/**
|
||||
* Read the {@link java.math.BigDecimal} value at index '<code>index</code>'.
|
||||
*
|
||||
* @param index the field index.
|
||||
* @throws IndexOutOfBoundsException if the index is out of bounds.
|
||||
*/
|
||||
BigDecimal readBigDecimal(int index);
|
||||
|
||||
/**
|
||||
* Read the {@link java.math.BigDecimal} value from column with given '<code>name</code>.
|
||||
*
|
||||
* @param name the field name.
|
||||
* @throws IllegalArgumentException if a column with given name is not
|
||||
* defined.
|
||||
*/
|
||||
BigDecimal readBigDecimal(String name);
|
||||
|
||||
/**
|
||||
* Read the {@link BigDecimal} value at index '<code>index</code>',
|
||||
* returning the supplied <code>defaultValue</code> if the trimmed string
|
||||
* value at index '<code>index</code>' is blank.
|
||||
*
|
||||
* @param index the field index.
|
||||
* @throws IndexOutOfBoundsException if the index is out of bounds.
|
||||
*/
|
||||
BigDecimal readBigDecimal(int index, BigDecimal defaultValue);
|
||||
|
||||
/**
|
||||
* Read the {@link BigDecimal} value from column with given '<code>name</code>,
|
||||
* returning the supplied <code>defaultValue</code> if the trimmed string
|
||||
* value at index '<code>index</code>' is blank.
|
||||
*
|
||||
* @param name the field name.
|
||||
* @throws IllegalArgumentException if a column with given name is not
|
||||
* defined.
|
||||
*/
|
||||
BigDecimal readBigDecimal(String name, BigDecimal defaultValue);
|
||||
|
||||
/**
|
||||
* Read the <code>java.util.Date</code> value in default format at
|
||||
* designated column <code>index</code>.
|
||||
*
|
||||
* @param index the field index.
|
||||
* @param pattern the pattern describing the date and time format
|
||||
* @throws IndexOutOfBoundsException if the index is out of bounds.
|
||||
* @see #DEFAULT_DATE_PATTERN
|
||||
*/
|
||||
Date readDate(int index);
|
||||
|
||||
/**
|
||||
* Read the <code>java.sql.Date</code> value in given format from column
|
||||
* with given <code>name</code>.
|
||||
*
|
||||
* @param name the field name.
|
||||
* @param pattern the pattern describing the date and time format
|
||||
* @throws IllegalArgumentException if a column with given name is not
|
||||
* defined.
|
||||
* @see #DEFAULT_DATE_PATTERN
|
||||
*/
|
||||
Date readDate(String name);
|
||||
|
||||
/**
|
||||
* Read the <code>java.util.Date</code> value in default format at
|
||||
* designated column <code>index</code>.
|
||||
*
|
||||
* @param index the field index.
|
||||
* @param pattern the pattern describing the date and time format
|
||||
* @throws IndexOutOfBoundsException if the index is out of bounds.
|
||||
* @throws IllegalArgumentException if the date cannot be parsed.
|
||||
*
|
||||
*/
|
||||
Date readDate(int index, String pattern);
|
||||
|
||||
/**
|
||||
* Read the <code>java.sql.Date</code> value in given format from column
|
||||
* with given <code>name</code>.
|
||||
*
|
||||
* @param name the field name.
|
||||
* @param pattern the pattern describing the date and time format
|
||||
* @throws IllegalArgumentException if a column with given name is not
|
||||
* defined or if the specified field cannot be parsed
|
||||
*
|
||||
*/
|
||||
Date readDate(String name, String pattern);
|
||||
|
||||
/**
|
||||
* Return the number of fields in this '<code>FieldSet</code>'.
|
||||
*/
|
||||
int getFieldCount();
|
||||
|
||||
/**
|
||||
* Construct name-value pairs from the field names and string values. Null
|
||||
* values are omitted.
|
||||
*
|
||||
* @return some properties representing the field set.
|
||||
*
|
||||
* @throws IllegalStateException if the field name meta data is not
|
||||
* available.
|
||||
*/
|
||||
Properties getProperties();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user