|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.blackbear.flatworm.converters.CoreConverters
public class CoreConverters
CoreConverters
contains methods to convert the most commonly encountered text types to native Java
types. It can be used as the class
parameter in a Flatworm converter
tag, with one of
the public methods listed below as the method
parameter.
conversion-option
s:
justify
pad-character
option. Valid values are:
left
to strip the right hand side of the field of pad charsright
to strip the left hand side of the field of pad charsboth
to strip both end of the field of pad charsboth
pad-character
justify
option when removing or adding
pad characters from a field. The default value is the space character.default-value
Constructor Summary | |
---|---|
CoreConverters()
|
Method Summary | |
---|---|
java.lang.String |
convertBigDecimal(java.lang.Object obj,
java.util.HashMap options)
|
java.math.BigDecimal |
convertBigDecimal(java.lang.String str,
java.util.HashMap options)
Conversion function for BigDecimal , returns the source string with padding removed if requested,
converted into a big decimal. |
java.lang.String |
convertChar(java.lang.Object obj,
java.util.HashMap options)
Object->String conversion function. |
java.lang.String |
convertChar(java.lang.String str,
java.util.HashMap options)
Conversion function for String , returns the source string with padding removed if requested. |
java.lang.String |
convertDate(java.lang.Object obj,
java.util.HashMap options)
Date->String conversion function. |
java.util.Date |
convertDate(java.lang.String str,
java.util.HashMap options)
Conversion function for Date , returns the source string with padding removed if requested,
converted into a date. |
java.lang.String |
convertDecimal(java.lang.Object obj,
java.util.HashMap options)
|
java.lang.Double |
convertDecimal(java.lang.String str,
java.util.HashMap options)
Conversion function for Double , returns the source string with padding removed if requested,
converted into a double. |
java.lang.String |
convertInteger(java.lang.Object obj,
java.util.HashMap options)
|
java.lang.Integer |
convertInteger(java.lang.String str,
java.util.HashMap options)
Conversion function for Integer , returns the source string with padding removed if requested,
converted into a integer. |
java.lang.String |
convertLong(java.lang.Object obj,
java.util.HashMap options)
|
java.lang.Long |
convertLong(java.lang.String str,
java.util.HashMap options)
Conversion function for Long , returns the source string with padding removed if requested,
converted into a long. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CoreConverters()
Method Detail |
---|
public java.lang.String convertChar(java.lang.String str, java.util.HashMap options)
String
, returns the source string with padding removed if requested.
str
- The source stringoptions
- The conversion-option values for the field
public java.lang.String convertChar(java.lang.Object obj, java.util.HashMap options)
obj
- source objectoptions
- The conversion-option values for the field
public java.util.Date convertDate(java.lang.String str, java.util.HashMap options) throws FlatwormConversionException
Date
, returns the source string with padding removed if requested,
converted into a date. In addition to the standard conversion options, dates also support the following:
format
SimpleDateFormat
syntax that defines the format to expect, default is
yyyy-MM-dd.
str
- The source stringoptions
- The conversion-option values for the field
FlatwormConversionException
- if the date fails to parse correctly.public java.lang.String convertDate(java.lang.Object obj, java.util.HashMap options)
obj
- source object of type Date
.options
- The conversion-option values for the field
public java.lang.Double convertDecimal(java.lang.String str, java.util.HashMap options) throws FlatwormConversionException
Double
, returns the source string with padding removed if requested,
converted into a double. In addition to the standard conversion options, doubles also support the following:
decimal-implied
true
, the decimal point is positionally implied rather than explicitly included.
If set, decimal-places
is required.decimal-places
decimal-implied
is set.
str
- The source stringoptions
- The conversion-option values for the field
FlatwormConversionException
- If the source number fails to parse as a double or the decimal places option
fails to parse as an integer value.public java.lang.String convertDecimal(java.lang.Object obj, java.util.HashMap options)
public java.lang.Integer convertInteger(java.lang.String str, java.util.HashMap options) throws FlatwormConversionException
Integer
, returns the source string with padding removed if requested,
converted into a integer.
str
- The source stringoptions
- The conversion-option values for the field
FlatwormConversionException
- If the source number fails to parse as an integer value.public java.lang.String convertInteger(java.lang.Object obj, java.util.HashMap options)
public java.lang.Long convertLong(java.lang.String str, java.util.HashMap options) throws FlatwormConversionException
Long
, returns the source string with padding removed if requested,
converted into a long.
str
- The source stringoptions
- The conversion-option values for the field
FlatwormConversionException
- If the source number fails to parse as an long value.public java.lang.String convertLong(java.lang.Object obj, java.util.HashMap options)
public java.math.BigDecimal convertBigDecimal(java.lang.String str, java.util.HashMap options) throws FlatwormConversionException
BigDecimal
, returns the source string with padding removed if requested,
converted into a big decimal. In addition to the standard conversion options, big decimals also support the
following:
decimal-implied
true
, the decimal point is positionally implied rather than explicitly included.
If set, decimal-places
is required.decimal-places
decimal-implied
is set.
str
- The source stringoptions
- The conversion-option values for the field
FlatwormConversionException
- If the source number fails to parse as a big decimal or the decimal places
option fails to parse as an integer value.public java.lang.String convertBigDecimal(java.lang.Object obj, java.util.HashMap options)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |