|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.batch.item.file.transform.DefaultFieldSet
public class DefaultFieldSet
Default implementation of FieldSet
using Java using Java primitive
and standard types and utilities. Strings are trimmed before parsing by
default, and so are plain String values.
Constructor Summary | |
---|---|
DefaultFieldSet(String[] tokens)
Create a FieldSet with anonymous tokens. |
|
DefaultFieldSet(String[] tokens,
String[] names)
Create a FieldSet with named tokens. |
Method Summary | |
---|---|
boolean |
equals(Object object)
|
int |
getFieldCount()
Return the number of fields in this ' FieldSet '. |
String[] |
getNames()
Accessor for the names of the fields. |
Properties |
getProperties()
Construct name-value pairs from the field names and string values. |
String[] |
getValues()
|
int |
hashCode()
|
boolean |
hasNames()
Check if there are names defined for the fields. |
protected int |
indexOf(String name)
Read and trim the String value from column with given '
name . |
protected String |
readAndTrim(int index)
Read and trim the String value at 'index '. |
BigDecimal |
readBigDecimal(int index)
Read the BigDecimal value at index 'index '. |
BigDecimal |
readBigDecimal(int index,
BigDecimal defaultValue)
Read the BigDecimal value at index 'index ',
returning the supplied defaultValue if the trimmed string
value at index 'index ' is blank. |
BigDecimal |
readBigDecimal(String name)
Read the BigDecimal value from column with given 'name . |
BigDecimal |
readBigDecimal(String name,
BigDecimal defaultValue)
Read the BigDecimal value from column with given 'name ,
returning the supplied defaultValue if the trimmed string
value at index 'index ' is blank. |
boolean |
readBoolean(int index)
Read the ' boolean ' value at index 'index '. |
boolean |
readBoolean(int index,
String trueValue)
Read the ' boolean ' value at index 'index '. |
boolean |
readBoolean(String name)
Read the ' boolean ' value from column with given 'name '. |
boolean |
readBoolean(String name,
String trueValue)
Read the ' boolean ' value from column with given 'name '. |
byte |
readByte(int index)
Read the ' byte ' value at index 'index '. |
byte |
readByte(String name)
Read the ' byte ' value from column with given 'name '. |
char |
readChar(int index)
Read the ' char ' value at index 'index '. |
char |
readChar(String name)
Read the ' char ' value from column with given 'name '. |
Date |
readDate(int index)
Read the java.util.Date value in default format at
designated column index . |
Date |
readDate(int index,
Date defaultValue)
Read the java.util.Date value in default format at
designated column index . |
Date |
readDate(int index,
String pattern)
Read the java.util.Date value in default format at
designated column index . |
Date |
readDate(int index,
String pattern,
Date defaultValue)
Read the java.util.Date value in default format at
designated column index . |
Date |
readDate(String name)
Read the java.sql.Date value in given format from column
with given name . |
Date |
readDate(String name,
Date defaultValue)
Read the java.sql.Date value in given format from column
with given name . |
Date |
readDate(String name,
String pattern)
Read the java.sql.Date value in given format from column
with given name . |
Date |
readDate(String name,
String pattern,
Date defaultValue)
Read the java.sql.Date value in given format from column
with given name . |
double |
readDouble(int index)
Read the ' double ' value at index 'index '. |
double |
readDouble(String name)
Read the ' double ' value from column with given 'name . |
float |
readFloat(int index)
Read the ' float ' value at index 'index '. |
float |
readFloat(String name)
Read the ' float ' value from column with given 'name . |
int |
readInt(int index)
Read the ' int ' value at index 'index '. |
int |
readInt(int index,
int defaultValue)
Read the ' int ' value at index 'index ',
using the supplied defaultValue if the field value is
blank. |
int |
readInt(String name)
Read the ' int ' value from column with given 'name '. |
int |
readInt(String name,
int defaultValue)
Read the ' int ' value from column with given 'name ',
using the supplied defaultValue if the field value is
blank. |
long |
readLong(int index)
Read the ' long ' value at index 'index '. |
long |
readLong(int index,
long defaultValue)
Read the ' long ' value at index 'index ',
using the supplied defaultValue if the field value is
blank. |
long |
readLong(String name)
Read the ' long ' value from column with given 'name '. |
long |
readLong(String name,
long defaultValue)
Read the ' long ' value from column with given 'name ',
using the supplied defaultValue if the field value is
blank. |
String |
readRawString(int index)
Read the String value at index 'index ' including
trailing whitespace (don't trim). |
String |
readRawString(String name)
Read the String value from column with given 'name '
including trailing whitespace (don't trim). |
short |
readShort(int index)
Read the ' short ' value at index 'index '. |
short |
readShort(String name)
Read the ' short ' value from column with given 'name '. |
String |
readString(int index)
Read the String value at index 'index '. |
String |
readString(String name)
Read the String value from column with given 'name '. |
void |
setDateFormat(DateFormat dateFormat)
The DateFormat to use for parsing numbers. |
void |
setNumberFormat(NumberFormat numberFormat)
The NumberFormat to use for parsing numbers. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DefaultFieldSet(String[] tokens)
tokens
- the token valuesFieldSet.readString(int)
public DefaultFieldSet(String[] tokens, String[] names)
tokens
- the token valuesnames
- the names of the tokensFieldSet.readString(String)
Method Detail |
---|
public final void setNumberFormat(NumberFormat numberFormat)
NumberFormat
to use for parsing numbers. If unset the US
locale will be used ('.' as decimal place).
numberFormat
- the NumberFormat
to use for number parsingpublic void setDateFormat(DateFormat dateFormat)
DateFormat
to use for parsing numbers. If unset the default
pattern is ISO standard yyyy/MM/dd
.
dateFormat
- the DateFormat
to use for date parsingpublic String[] getNames()
FieldSet
getNames
in interface FieldSet
public boolean hasNames()
FieldSet
hasNames
in interface FieldSet
public String[] getValues()
getValues
in interface FieldSet
FieldSet
' instance as
String values.public String readString(int index)
FieldSet
String
value at index 'index
'.
readString
in interface FieldSet
index
- the field index.public String readString(String name)
FieldSet
String
value from column with given 'name
'.
readString
in interface FieldSet
name
- the field name.public String readRawString(int index)
FieldSet
String
value at index 'index
' including
trailing whitespace (don't trim).
readRawString
in interface FieldSet
index
- the field index.public String readRawString(String name)
FieldSet
String
value from column with given 'name
'
including trailing whitespace (don't trim).
readRawString
in interface FieldSet
name
- the field name.public boolean readBoolean(int index)
FieldSet
boolean
' value at index 'index
'.
readBoolean
in interface FieldSet
index
- the field index.public boolean readBoolean(String name)
FieldSet
boolean
' value from column with given 'name
'.
readBoolean
in interface FieldSet
name
- the field name.public boolean readBoolean(int index, String trueValue)
FieldSet
boolean
' value at index 'index
'.
readBoolean
in interface FieldSet
index
- the field index.trueValue
- the value that signifies true
;
case-sensitive.public boolean readBoolean(String name, String trueValue)
FieldSet
boolean
' value from column with given 'name
'.
readBoolean
in interface FieldSet
name
- the field name.trueValue
- the value that signifies true
;
case-sensitive.public char readChar(int index)
FieldSet
char
' value at index 'index
'.
readChar
in interface FieldSet
index
- the field index.public char readChar(String name)
FieldSet
char
' value from column with given 'name
'.
readChar
in interface FieldSet
name
- the field name.public byte readByte(int index)
FieldSet
byte
' value at index 'index
'.
readByte
in interface FieldSet
index
- the field index.public byte readByte(String name)
FieldSet
byte
' value from column with given 'name
'.
readByte
in interface FieldSet
name
- the field name.public short readShort(int index)
FieldSet
short
' value at index 'index
'.
readShort
in interface FieldSet
index
- the field index.public short readShort(String name)
FieldSet
short
' value from column with given 'name
'.
readShort
in interface FieldSet
name
- the field name.public int readInt(int index)
FieldSet
int
' value at index 'index
'.
readInt
in interface FieldSet
index
- the field index.public int readInt(String name)
FieldSet
int
' value from column with given 'name
'.
readInt
in interface FieldSet
name
- the field name.public int readInt(int index, int defaultValue)
FieldSet
int
' value at index 'index
',
using the supplied defaultValue
if the field value is
blank.
readInt
in interface FieldSet
index
- the field index..public int readInt(String name, int defaultValue)
FieldSet
int
' value from column with given 'name
',
using the supplied defaultValue
if the field value is
blank.
readInt
in interface FieldSet
name
- the field name.public long readLong(int index)
FieldSet
long
' value at index 'index
'.
readLong
in interface FieldSet
index
- the field index.public long readLong(String name)
FieldSet
long
' value from column with given 'name
'.
readLong
in interface FieldSet
name
- the field name.public long readLong(int index, long defaultValue)
FieldSet
long
' value at index 'index
',
using the supplied defaultValue
if the field value is
blank.
readLong
in interface FieldSet
index
- the field index..public long readLong(String name, long defaultValue)
FieldSet
long
' value from column with given 'name
',
using the supplied defaultValue
if the field value is
blank.
readLong
in interface FieldSet
name
- the field name.public float readFloat(int index)
FieldSet
float
' value at index 'index
'.
readFloat
in interface FieldSet
index
- the field index.public float readFloat(String name)
FieldSet
float
' value from column with given 'name
.
readFloat
in interface FieldSet
name
- the field name.public double readDouble(int index)
FieldSet
double
' value at index 'index
'.
readDouble
in interface FieldSet
index
- the field index.public double readDouble(String name)
FieldSet
double
' value from column with given 'name
.
readDouble
in interface FieldSet
name
- the field name.public BigDecimal readBigDecimal(int index)
FieldSet
BigDecimal
value at index 'index
'.
readBigDecimal
in interface FieldSet
index
- the field index.public BigDecimal readBigDecimal(String name)
FieldSet
BigDecimal
value from column with given 'name
.
readBigDecimal
in interface FieldSet
name
- the field name.public BigDecimal readBigDecimal(int index, BigDecimal defaultValue)
FieldSet
BigDecimal
value at index 'index
',
returning the supplied defaultValue
if the trimmed string
value at index 'index
' is blank.
readBigDecimal
in interface FieldSet
index
- the field index.public BigDecimal readBigDecimal(String name, BigDecimal defaultValue)
FieldSet
BigDecimal
value from column with given 'name
,
returning the supplied defaultValue
if the trimmed string
value at index 'index
' is blank.
readBigDecimal
in interface FieldSet
name
- the field name.defaultValue
- the default value to use if the field is blankpublic Date readDate(int index)
FieldSet
java.util.Date
value in default format at
designated column index
.
readDate
in interface FieldSet
index
- the field index.public Date readDate(int index, Date defaultValue)
FieldSet
java.util.Date
value in default format at
designated column index
.
readDate
in interface FieldSet
index
- the field index.defaultValue
- the default value to use if the field is blankpublic Date readDate(String name)
FieldSet
java.sql.Date
value in given format from column
with given name
.
readDate
in interface FieldSet
name
- the field name.public Date readDate(String name, Date defaultValue)
FieldSet
java.sql.Date
value in given format from column
with given name
.
readDate
in interface FieldSet
name
- the field name.defaultValue
- the default value to use if the field is blankpublic Date readDate(int index, String pattern)
FieldSet
java.util.Date
value in default format at
designated column index
.
readDate
in interface FieldSet
index
- the field index.pattern
- the pattern describing the date and time formatpublic Date readDate(int index, String pattern, Date defaultValue)
FieldSet
java.util.Date
value in default format at
designated column index
.
readDate
in interface FieldSet
index
- the field index.pattern
- the pattern describing the date and time formatdefaultValue
- the default value to use if the field is blankpublic Date readDate(String name, String pattern)
FieldSet
java.sql.Date
value in given format from column
with given name
.
readDate
in interface FieldSet
name
- the field name.pattern
- the pattern describing the date and time formatpublic Date readDate(String name, String pattern, Date defaultValue)
FieldSet
java.sql.Date
value in given format from column
with given name
.
readDate
in interface FieldSet
name
- the field name.pattern
- the pattern describing the date and time formatdefaultValue
- the default value to use if the field is blankpublic int getFieldCount()
FieldSet
FieldSet
'.
getFieldCount
in interface FieldSet
protected String readAndTrim(int index)
String
value at 'index
'.
protected int indexOf(String name)
String
value from column with given '
name
.
IllegalArgumentException
- if a column with given name is not
defined.public String toString()
toString
in class Object
public boolean equals(Object object)
equals
in class Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class Object
public Properties getProperties()
FieldSet
getProperties
in interface FieldSet
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |