com.blackbear.flatworm
Class ConversionHelper
java.lang.Object
com.blackbear.flatworm.ConversionHelper
public class ConversionHelper
- extends java.lang.Object
The ConversionHelper was created to seperate formatting responsibility into a seperate class.
This class also makes writing your own converter more of a reality by seperating type conversion from string formatting.
String formatting has moved to a seperate class called Util.
Method Summary |
void |
addConverter(com.blackbear.flatworm.Converter converter)
Facilitates the storage of multiple converters used by the convert method during processing |
java.lang.String |
convert(java.lang.String type,
java.lang.Object obj,
java.util.HashMap options,
java.lang.String beanRef)
|
java.lang.Object |
convert(java.lang.String type,
java.lang.String fieldChars,
java.util.HashMap options,
java.lang.String beanRef)
|
java.lang.String |
transformString(java.lang.String fieldChars,
java.util.HashMap options,
int length)
Handles the processing of the Conversion-Options from the flatworm XML file |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ConversionHelper
public ConversionHelper()
convert
public java.lang.Object convert(java.lang.String type,
java.lang.String fieldChars,
java.util.HashMap options,
java.lang.String beanRef)
throws FlatwormConversionException
- Parameters:
String
- type from the xml configuration fileString
- as read from the input fileHashmap
- contains ConversionOoptions (if any) for this fieldString
- format - "class.property", used for more descriptive exception messages, should something go wrong
- Returns:
- Object Java type corresponding to the field type, post conversion
- Throws:
FlatwormConversionException
- - if problems are encountered during the conversion process (wraps other
exceptions)
convert
public java.lang.String convert(java.lang.String type,
java.lang.Object obj,
java.util.HashMap options,
java.lang.String beanRef)
throws FlatwormConversionException
- Throws:
FlatwormConversionException
transformString
public java.lang.String transformString(java.lang.String fieldChars,
java.util.HashMap options,
int length)
- Handles the processing of the Conversion-Options from the flatworm XML file
- Parameters:
String
- string you wish to transformHashMap
- collection of ConversionOption objectsint
- used in justification to ensure proper formatting
- Returns:
- String - string after transformation
addConverter
public void addConverter(com.blackbear.flatworm.Converter converter)
- Facilitates the storage of multiple converters used by the
convert
method during processing
- Parameters:
Converter
- converter to store