| java.lang.Object org.andromda.core.translation.TranslationUtils
TranslationUtils | public class TranslationUtils (Code) | | Contains translation utilities.
author: Chad Brandon |
Constructor Summary | |
public | TranslationUtils()
TranslationUtils instances should NOT be constructed in standard programming. |
Method Summary | |
public static boolean | containsPattern(String string, String pattern) Returns true if the specified pattern with braces around it, like so --> "{pattern}" exists in the string. | public static String | deleteWhitespace(Object object) Calls the object's toString method and deletes any whitespace from the value. | public static Object | getProperty(Object bean, String property) | public static String | getPropertyAsString(Object bean, String property) | public static String | getStartingProperty(String property) Retrieves the "starting" property name from one that is nested, for example, will return ' ' from the
string --> . | public static String | removeExtraWhitespace(String string) Removes any extra whitepace --> does not remove the spaces between the words. | public static String | replaceFirstPattern(String string, String pattern, String replaceWith) Searches for and replaces the specified pattern with braces around it, like so --> "{pattern}" the first time it
occurs in the string
Parameters: string - the string to to perform replacement on. Parameters: pattern - the pattern to find Parameters: replaceWith - the pattern to place the existing one with. | public static String | replacePattern(String string, String pattern, String replaceWith) Searches for and replaces the specified pattern with braces around it, like so --> "{pattern}" every time it
occurs in the string.
Parameters: string - the string to to perform replacement on. Parameters: pattern - the pattern to find Parameters: replaceWith - the pattern to place the existing one with. | public static String | trimToEmpty(Object object) Calls the object's toString method and trims the value. |
TranslationUtils | public TranslationUtils()(Code) | |
TranslationUtils instances should NOT be constructed in standard programming. Instead, the class
should be used as TranslationUtils.replacePattern(" some pattern "); .
This constructor is public to permit tools that require a JavaBean instance to operate.
|
containsPattern | public static boolean containsPattern(String string, String pattern)(Code) | | Returns true if the specified pattern with braces around it, like so --> "{pattern}" exists in the string.
Parameters: string - the string to to perform replacement on. Parameters: pattern - the pattern to find boolean true if the string contains the pattern, false otherwise |
deleteWhitespace | public static String deleteWhitespace(Object object)(Code) | | Calls the object's toString method and deletes any whitespace from the value. Returns and empty string if null is
given.
Parameters: object - the object to deleteWhite space from. String |
getProperty | public static Object getProperty(Object bean, String property)(Code) | | Just retriieves properties from a bean, but gives a more informational error when the property can't be
retrieved, it also cleans the resulting property from any excess white space
Parameters: bean - the bean from which to retrieve the property Parameters: property - the property name Object the value of the property |
getPropertyAsString | public static String getPropertyAsString(Object bean, String property)(Code) | | Just retriieves properties from a bean, but gives a more informational error when the property can't be
retrieved, it also cleans the resulting property from any excess white space
Parameters: bean - the bean from which to retrieve the property Parameters: property - the property name Object the value of the property |
getStartingProperty | public static String getStartingProperty(String property)(Code) | | Retrieves the "starting" property name from one that is nested, for example, will return ' ' from the
string --> . . . If the property isn't nested, then just return the name that is passed in.
Parameters: property - the property. String |
removeExtraWhitespace | public static String removeExtraWhitespace(String string)(Code) | | Removes any extra whitepace --> does not remove the spaces between the words. Only removes tabs and newline
characters. This is to allow everything to be on one line while keeping the spaces between words.
Parameters: string - String the string with the removed extra spaces. |
replaceFirstPattern | public static String replaceFirstPattern(String string, String pattern, String replaceWith)(Code) | | Searches for and replaces the specified pattern with braces around it, like so --> "{pattern}" the first time it
occurs in the string
Parameters: string - the string to to perform replacement on. Parameters: pattern - the pattern to find Parameters: replaceWith - the pattern to place the existing one with. String the string will all replacements |
replacePattern | public static String replacePattern(String string, String pattern, String replaceWith)(Code) | | Searches for and replaces the specified pattern with braces around it, like so --> "{pattern}" every time it
occurs in the string.
Parameters: string - the string to to perform replacement on. Parameters: pattern - the pattern to find Parameters: replaceWith - the pattern to place the existing one with. String the string will all replacements |
trimToEmpty | public static String trimToEmpty(Object object)(Code) | | Calls the object's toString method and trims the value. Returns and empty string if null is given.
Parameters: object - the object to use. String |
|
|