| org.andromda.utils.StringUtilsHelper
StringUtilsHelper | public class StringUtilsHelper extends StringUtils (Code) | | A utility object for doing string manipulation operations that are commonly
needed by the code generation templates.
author: Matthias Bohlen author: Chris Shaw author: Chad Brandon author: Wouter Zoons |
Method Summary | |
public static String | format(String plainText) Formats the argument string without any indentiation, the text will be
wrapped at the default column. | public static String | format(String plainText, String indentation) Formats the given argument with the specified indentiation, wrapping the
text at a 64 column margin. | public static String | format(String plainText, String indentation, int wrapAtColumn) Formats the given argument with the specified indentiation, wrapping the
text at the desired column margin. | public static String | format(String plainText, String indentation, int wrapAtColumn, boolean htmlStyle)
Formats the given argument with the specified indentation, wrapping the
text at the desired column margin. | public static String | getLineSeparator() Gets the line separator. | public static String | lowerCamelCaseName(String string) Returns the argument string as a camel cased name beginning with a
lowercased letter. | public static String | pluralize(String singularNoun) Linguistically pluralizes a singular noun. | public static String | prefixWithAPredicate(String word) Takes an english word as input and prefixes it with 'a ' or 'an '
depending on the first character of the argument String. | public static String | removeLastOccurrence(String string, String value) Removes the last occurance of the oldValue found within the string.
Parameters: string - the String to remove the value from. Parameters: value - the value to remove. | public static String | replaceSuffix(String src, String suffixOld, String suffixNew) Replaces a given suffix of the source string with a new one. | public static String | separate(String string, String separator) Converts the argument to lowercase, removes all non-word characters, and
replaces each of those sequences by the separator. | public static String | suffixLines(String multiLines, String suffix) Suffixes each line with the argument suffix. | public static String | toPhrase(String string) Converts into a string suitable as a human readable phrase, First
character is uppercase (the rest is left unchanged), words are separated
by a space. | public static String | toResourceMessage(String multiLines) Converts any multi-line String into a version that is suitable to be
included as-is in properties resource bundle. | public static String | toResourceMessageKey(String string) Converts the argument into a message key in a properties resource bundle,
all lowercase characters, words are separated by dots. | public static String | toSingleLine(String string) Converts multiline text into a single line, normalizing whitespace in the
process. | public static String | upperCamelCaseName(String string) Returns the argument string as a camel cased name beginning with an
uppercased letter. |
format | public static String format(String plainText, String indentation, int wrapAtColumn, boolean htmlStyle)(Code) | |
Formats the given argument with the specified indentation, wrapping the
text at the desired column margin.
When enabling htmlStyle the returned text will be suitable for
display in HTML environments such as JavaDoc, all newlines will be
replaced by paragraphs.
This method trims the input text: all leading and trailing whitespace
will be removed.
If for some reason this method would fail it will return the
plainText argument.
Parameters: plainText - the text to format, the empty string will be returned incase this argument is null ; long words will beplaced on a newline but will never be wrapped Parameters: indentation - the empty string will be used if this argument wouldbe null Parameters: wrapAtColumn - does not take into account the length of theindentation, needs to be stricly positive Parameters: htmlStyle - whether or not to make sure the returned string issuited for display in HTML environments such as JavaDoc a String instance which represents the formatted input, nevernull throws: IllegalArgumentException - when the wrapAtColumnargument is not strictly positive |
getLineSeparator | public static String getLineSeparator()(Code) | | Gets the line separator.
the line separator. |
lowerCamelCaseName | public static String lowerCamelCaseName(String string)(Code) | | Returns the argument string as a camel cased name beginning with a
lowercased letter.
Non word characters be removed and the letter following such a
character will be uppercased.
Parameters: string - any string the string converted to a camel cased name beginning with a lowercased letter. |
pluralize | public static String pluralize(String singularNoun)(Code) | | Linguistically pluralizes a singular noun.
noun becomes nouns
key becomes keys
word becomes words
property becomes properties
bus becomes busses
boss becomes bosses
Whitespace as well as null arguments will return an
empty String.
Parameters: singularNoun - A singular noun to pluralize The plural of the argument singularNoun or the empty String if the argument isnull or blank. |
prefixWithAPredicate | public static String prefixWithAPredicate(String word)(Code) | | Takes an english word as input and prefixes it with 'a ' or 'an '
depending on the first character of the argument String. The
characters 'a', 'e', 'i' and 'o' will yield the 'an' predicate while all
the others will yield the 'a' predicate.
Parameters: word - the word needing the predicate the argument prefixed with the predicate |
removeLastOccurrence | public static String removeLastOccurrence(String string, String value)(Code) | | Removes the last occurance of the oldValue found within the string.
Parameters: string - the String to remove the value from. Parameters: value - the value to remove. String the resulting string. |
replaceSuffix | public static String replaceSuffix(String src, String suffixOld, String suffixNew)(Code) | | Replaces a given suffix of the source string with a new one. If the
suffix isn't present, the string is returned unmodified.
Parameters: src - the String for which the suffix should bereplaced Parameters: suffixOld - a String with the suffix that should bereplaced Parameters: suffixNew - a String with the new suffix a String with the given suffix replaced orunmodified if the suffix isn't present |
separate | public static String separate(String string, String separator)(Code) | | Converts the argument to lowercase, removes all non-word characters, and
replaces each of those sequences by the separator.
|
suffixLines | public static String suffixLines(String multiLines, String suffix)(Code) | | Suffixes each line with the argument suffix.
Parameters: multiLines - A String, optionally containing many lines Parameters: suffix - The suffix to append to the end of each line String The input String with the suffix appended at the end ofeach line |
toPhrase | public static String toPhrase(String string)(Code) | | Converts into a string suitable as a human readable phrase, First
character is uppercase (the rest is left unchanged), words are separated
by a space.
Parameters: string - any string the string converted to a value that would be well-suited for ahuman readable phrase |
toResourceMessage | public static String toResourceMessage(String multiLines)(Code) | | Converts any multi-line String into a version that is suitable to be
included as-is in properties resource bundle.
Parameters: multiLines - A String, optionally containing many lines String The input String with a backslash appended at the end ofeach line, or null if the input String was blank. |
toResourceMessageKey | public static String toResourceMessageKey(String string)(Code) | | Converts the argument into a message key in a properties resource bundle,
all lowercase characters, words are separated by dots.
Parameters: string - any string the string converted to a value that would be well-suited for amessage key |
toSingleLine | public static String toSingleLine(String string)(Code) | | Converts multiline text into a single line, normalizing whitespace in the
process. This means whitespace characters will not follow each other
directly. The resulting String will be trimmed. If the
input String is null the return value will be an empty string.
Parameters: string - A String, may be null The argument in a single line |
upperCamelCaseName | public static String upperCamelCaseName(String string)(Code) | | Returns the argument string as a camel cased name beginning with an
uppercased letter.
Non word characters be removed and the letter following such a
character will be uppercased.
Parameters: string - any string the string converted to a camel cased name beginning with a lowercased letter. |
|
|