| 
 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jaffa.util.StringHelper
Utility Class for Common String Manipulation routines.
| Nested Class Summary | |
| static class | StringHelper.LineThis class contains the contents of a line and the EOL character. | 
| Constructor Summary | |
| StringHelper() | |
| Method Summary | |
| static String | addCommentWithStamp(String originalComment,
                                       String additionalComment,
                                       boolean lifo,
                                       String userId)This is a helper for combining old and additional comments. | 
| static String | addHTMLLineBreak(String s,
                                 int lineLimit)This method will add HTML line breaks in the input String at the specified limits. | 
| static String | convertFromHTML(String s)Convert a string that has XML (and HTML) entities in it, into a regular string It will convert the following... | 
| static String | convertToHTML(String s)Convert a regular string into an XML (and HTML) based string It will convert the following | 
| static ArrayList | convertToList(String commaList)Converts a comma delimmitered string into an array of strings | 
| static String | findEol(String input)Returns the EOL character for the input String, if any. | 
| static String | formatDescription(Object field,
                                   String layout,
                                   String domainClassWithPackage,
                                   String domainField,
                                   boolean toHtml)This method is invoked in cases where 'description' field is appended to a 'code' field. | 
| static String | formatDescription(Object field,
                                   String layout,
                                   String domainClassWithPackage,
                                   String domainField,
                                   boolean toHtml,
                                   String beginMarker,
                                   String endMarker)This method is invoked in cases where 'description' field is appended to a 'code' field. | 
| static String | formatDescription(Object field,
                                   String layout,
                                   String domainClassWithPackage,
                                   String domainField,
                                   boolean toHtml,
                                   String beginMarker,
                                   String endMarker,
                                   int limit,
                                   String truncateIndicator)This method is invoked in cases where 'description' field is appended to a 'code' field. | 
| static String | getDefaultDescriptionBeginMarker()Returns the default String used in the formatDescription() methods placed at the beginning. | 
| static String | getDefaultDescriptionEndMarker()Returns the default String used in the formatDescription() methods placed at the end. | 
| static String | getLower(String input)A convenience method to translate the input String to LowerCase | 
| static String | getLower1(String input)A convenience method to translate the input String's 1st character to LowerCase, the rest of the string is left the same | 
| static String | getSpace(String input)A convenience method to translate the input String to words separated by spaces For eg: "abcDef" would be translated to "abc Def" | 
| static String | getStatic(String input)A convenience method to translate the input String to all UpperCase with underscores separating the words For eg: "abcDef" would be translated to "ABC_DEF" | 
| static String | getString(Reader reader)This returns the contents of a Reader as a String. | 
| static StringBuffer | getStringBuffer(Reader reader)This returns the contents of a Reader in a StringBuffer. | 
| static String | getUpper(String input)A convenience method to translate the input String to UpperCase | 
| static String | getUpper1(String input)A convenience method to translate the input String's 1st character to UpperCase, the rest of the string is left the same | 
| static String | linePad(String text,
               int indent)Pad each new line of the supplied string with the specified number of spaces | 
| static String | linePad(String text,
               int indent,
               String indentWith)Pad each new line of the supplied string with the specified number of 'indent Strings' | 
| static String | linePad(String text,
               int indent,
               String indentWith,
               boolean supressFirst)Pad each new line of the supplied string with the specified number of the indent string, but allows the suppression of the first line from indentation | 
| static void | main(String[] args)Test Routine | 
| static String | pad(int number)Pad a number to take up at least 2 characters | 
| static String | pad(int number,
       int length)Pad a number to take up a specified length | 
| static String | pad(int number,
       int len,
       String padVal)Pad a number to take up a specified length | 
| static String[] | parseString(String s)Tokenize the Input String with the default tokenizer (whitespace) | 
| static String[] | parseString(String s,
                       String delim)Tokenize the Input String with the given delim | 
| static StringHelper.Line | readLine(PushbackReader reader)Reads a line from the input reader. | 
| static String | replace(String source,
               String find,
               String replace)Basic find and replace on a string, it will replace ALL occurences of the string | 
| static String | replicate(String text,
                   int count)Produce a string by replicating the specific string the specified number of times | 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
public StringHelper()
| Method Detail | 
public static String pad(int number)
number - the number to pad
public static String pad(int number,
                         int length)
number - the number to padlength - length of resulting string
public static String pad(int number,
                         int len,
                         String padVal)
number - the number to padlen - length of resulting stringpadVal - Character to be used for Padding
public static String[] parseString(String s)
s - String to tokenize
public static String[] parseString(String s,
                                   String delim)
s - String to tokenizedelim - Deliminator to use
public static String linePad(String text,
                             int indent)
text - String to padindent - number of spaces to indent by
public static String linePad(String text,
                             int indent,
                             String indentWith)
text - String to padindent - number of spaces to indent byindentWith - String to use for indenting
public static String linePad(String text,
                             int indent,
                             String indentWith,
                             boolean supressFirst)
text - String to padindent - number of spaces to indent byindentWith - String to use for indentingsupressFirst - true, if the first line should be skipped when indenting
public static String replicate(String text,
                               int count)
text - String to replicatecount - number of times to replicate string
public static ArrayList convertToList(String commaList)
commaList - Source string
public static String convertFromHTML(String s)
s - String to convert
public static String convertToHTML(String s)
s - String to convert
public static String addHTMLLineBreak(String s,
                                      int lineLimit)
s - String to modifylineLimit - The interval at which the line breaks will be added.
public static String replace(String source,
                             String find,
                             String replace)
source - original stringfind - string to search forreplace - string to replace found strings with
public static String getLower1(String input)
input - the string to process
public static String getUpper1(String input)
input - the string to process
public static String getLower(String input)
input - the string to process
public static String getUpper(String input)
input - the string to process
public static String getStatic(String input)
input - the string to process
public static String getSpace(String input)
input - the string to process
public static StringBuffer getStringBuffer(Reader reader)
                                    throws IOException
reader - the input source.
IOException - if any error occurs in reading the contents of the input.
public static String getString(Reader reader)
                        throws IOException
reader - the input source.
IOException - if any error occurs in reading the contents of the input.
public static String formatDescription(Object field,
                                       String layout,
                                       String domainClassWithPackage,
                                       String domainField,
                                       boolean toHtml)
field - The description of the field.layout - The layout, if any to be used for formattingdomainClassWithPackage - The domainClass to determine the FieldMetaData object, to get a handle on the layout.domainField - The domainField to determine the FieldMetaData object, to get a handle on the layout.toHtml - if true, then the output will be converted to HTML.
public static String formatDescription(Object field,
                                       String layout,
                                       String domainClassWithPackage,
                                       String domainField,
                                       boolean toHtml,
                                       String beginMarker,
                                       String endMarker)
field - The description of the field.layout - The layout, if any to be used for formattingdomainClassWithPackage - The domainClass to determine the FieldMetaData object, to get a handle on the layout.domainField - The domainField to determine the FieldMetaData object, to get a handle on the layout.toHtml - if true, then the output will be converted to HTML.beginMarker - The marker at the start of the output. Default is ' ('endMarker - The marker at the end of the output. Default is ')'
public static String formatDescription(Object field,
                                       String layout,
                                       String domainClassWithPackage,
                                       String domainField,
                                       boolean toHtml,
                                       String beginMarker,
                                       String endMarker,
                                       int limit,
                                       String truncateIndicator)
field - The description of the field.layout - The layout, if any to be used for formattingdomainClassWithPackage - The domainClass to determine the FieldMetaData object, to get a handle on the layout.domainField - The domainField to determine the FieldMetaData object, to get a handle on the layout.toHtml - if true, then the output will be converted to HTML.beginMarker - The marker at the start of the output. Default is ' ('endMarker - The marker at the end of the output. Default is ')'limit - The limit for the formatted decription. Default is 25.truncateIndicator - The string to append tot he formatted description, if exceeds the limit and is truncated.
public static String getDefaultDescriptionBeginMarker()
public static String getDefaultDescriptionEndMarker()
public static String addCommentWithStamp(String originalComment,
                                         String additionalComment,
                                         boolean lifo,
                                         String userId)
originalComment - The original comment.additionalComment - The additional comment.lifo - This determines if the additional comment is inserted before or appended after the old comment.userId - The userId.
public static String findEol(String input)
public static StringHelper.Line readLine(PushbackReader reader)
                                  throws IOException
IOException - if any IO error occurs.public static void main(String[] args)
args - no args required| 
 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||