|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.blackbear.flatworm.Util
public final class Util
Static final class to hold string manipulation methods
Constructor Summary | |
---|---|
Util()
|
Method Summary | |
---|---|
static java.lang.String |
defaultValue(java.lang.String str,
java.lang.String value,
java.util.HashMap options)
If str is length zero (after trimming), value is returned. |
static java.lang.String |
formatDate(java.util.Date date,
java.lang.String defaultDateFormat,
java.util.HashMap options)
Different from the method in CoreConverters, this one is used for file creation Specified in flatworm XML file like: <conversion-option name="format" value="yyyy-MM-dd"/> |
static java.lang.String |
getValue(java.util.HashMap options,
java.lang.String key)
Conversion-Option now stored in class, more than a simple Hashmap lookup |
static java.lang.String |
justify(java.lang.String str,
java.lang.String value,
java.util.HashMap options,
int length)
Removes pre-determined chracters from string based on Java Patterns Specified in flatworm XML file like: <conversion-option name="justify" value="right"/> |
static java.lang.String[] |
split(java.lang.String str,
char chrSplit,
char chrQuote)
split divides a string into many strings based on a delimiter The main difference between this
split and the one that comes with Java is this one will ignore delimiters that are within quoted fields
NOTE: Delimiter will be ignored once chrQuote is encountered. |
static java.lang.String |
strip(java.lang.String str,
java.lang.String value,
java.util.HashMap options)
Removes pre-determined chracters from string based on Java Patterns Specified in flatworm XML file like: <conversion-option name="strip-chars" value="non-numeric"/> |
static java.lang.String |
substring(java.lang.String str,
java.lang.String value,
java.util.HashMap options)
Specified in flatworm XML file like: <conversion-option name="substring" value="1,10"/> |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Util()
Method Detail |
---|
public static java.lang.String[] split(java.lang.String str, char chrSplit, char chrQuote)
split
divides a string into many strings based on a delimiter The main difference between this
split and the one that comes with Java is this one will ignore delimiters that are within quoted fields
NOTE: Delimiter will be ignored once chrQuote is encountered. Consideration will begin once matching chrQuote is encountered
String
- you want to splitchar
- you want to split the string onchar
- you want to be considered to be your quoting character
public static java.lang.String formatDate(java.util.Date date, java.lang.String defaultDateFormat, java.util.HashMap options) throws java.lang.Exception
<conversion-option name="format" value="yyyy-MM-dd"/>
Date
- to be converted to a stringString
- defaultDateFormat is provided by FileCreator and is used when the date format is not supplied in
the Flatworm XML fileHashMap
- collection of ConversionOptions to gather further justification options
java.lang.Exception
- - if date format is not specified in the XML file or given to FileCreator. At least one must be
specified.public static java.lang.String justify(java.lang.String str, java.lang.String value, java.util.HashMap options, int length)
<conversion-option name="justify" value="right"/>
String
- field to be justifiedString
- value can be ('left'|'right'|'both') - default value is 'both' if not specifiedHashMap
- collection of ConversionOptions to gather further justification optionsint
- used in file creation to ensure string is padded to the proper length
public static java.lang.String strip(java.lang.String str, java.lang.String value, java.util.HashMap options)
<conversion-option name="strip-chars" value="non-numeric"/>
String
- field to be strippedString
- value can be ('non-numeric'|'non-alpha'|'non-alphanumeric')HashMap
- collection of ConversionOptions, for future enhancement
public static java.lang.String substring(java.lang.String str, java.lang.String value, java.util.HashMap options)
<conversion-option name="substring" value="1,10"/>
String
- value of fieldString
- default valueHashMap
- collection of ConversionOptions, for future enhancement
public static java.lang.String defaultValue(java.lang.String str, java.lang.String value, java.util.HashMap options)
String
- value of fieldString
- default valueHashMap
- collection of ConversionOptions, for future enhancement
public static java.lang.String getValue(java.util.HashMap options, java.lang.String key)
HashMap
- options The conversion-option values for the fieldString
- The key to lookup appropriate ConversionOption
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |