|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.taggercat.util.Text
public class Text
This class contains general text utility functions, such as parsing, and conversion methods. All methods in this class are static.
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
| Field Summary | |
|---|---|
static int |
DSN_TERM
the index of the the DSN in DSN.ROW_ID.FIELD_NAME string |
static int |
FIELDNAME_TERM
the index of the the FIELD NAME in DSN.ROW_ID.FIELD_NAME string |
static java.util.Map<java.lang.String,java.lang.Integer> |
namedScopes
|
static int |
ROWID_TERM
the index of the the ROW ID as in DSN.ROW_ID.FIELD_NAME string |
| Constructor Summary | |
|---|---|
Text()
|
|
| Method Summary | |
|---|---|
static void |
addAttribute(java.lang.StringBuilder sb,
java.lang.String attributeName,
java.lang.String value)
Wraps the attribute value in quotes, and adds it to the buffer. |
static void |
appendQuotedString(java.lang.StringBuffer sb,
java.lang.String s)
|
static void |
appendQuotedString(java.lang.StringBuffer sb,
java.lang.String s,
java.lang.String comma)
|
static java.lang.Object |
byteArrayToObject(byte[] objByteArray)
|
static java.lang.String |
convertCRLFToHRMLBreak(java.lang.String text)
|
static java.lang.String |
convertJavaToJSCalFormatPattern(java.lang.String javaFormatPattern)
Converts any characters in the Java Date-Time format pattern to the equivalent one for the JS calendar control. |
static java.lang.String |
convertJSPToAlias(java.lang.String jspfileName)
|
static java.lang.String |
convertNameToCaption(java.lang.String name)
|
static java.util.List<java.lang.String> |
delimitedStringToList(java.lang.String delimitedString)
Converts the delimited string into a list. |
static java.util.Map<java.lang.String,java.lang.String> |
delimitedStringToMap(java.lang.String delimitedString)
Converts the delimited string into a map. |
static java.lang.String |
encryptPassword(java.lang.String password)
Provides One-Way encryption, you can test if the same password is being used, but you can't be easily* un-encrypt it. |
static boolean |
equalStrings(java.lang.String s1,
java.lang.String s2)
Null safe string equals. |
static java.lang.String |
escapeHTML(java.lang.String text)
Escape HTML chars in the text string |
static java.lang.String |
escapeQuotes(java.lang.String src)
Escapes any double quote with a leading slash \. |
static java.lang.String |
escapeRegExChars(java.lang.String raw)
Escape any regular expression chars in the source text |
static java.lang.String |
escapeSingleQuotes(java.lang.String str)
Escape single quotes in a string with a leading backslash. |
static java.lang.String |
escapeSQL(java.lang.String str)
Escape single quotes in a SQL strings with a double single quotes. |
static java.lang.String |
escapeXML(java.lang.String text)
Escape XML chars in the text string |
static java.lang.String |
expandExpressions(java.lang.String expString,
com.taggercat.el.ELPropertyResolver elProperrtResolver,
com.taggercat.el.ELContext elContext)
This method parses, and replaces embedded expressions from the string with their corresponding expression results. |
static java.lang.String |
expandIndexedPlaceholders(java.lang.String expString,
java.util.List<?> values)
Expand indexed placeholders with their corresponding values. |
static java.lang.String |
expandIndexedPlaceholders(java.lang.String expString,
java.util.List<?> values,
boolean retainMissingPlaceholders)
Expand indexed placeholders with their corresponding values. |
static java.lang.String |
expandIndexedPlaceholders(java.lang.String expString,
java.lang.String[] values)
Expand indexed placeholders with their corresponding values. |
static java.lang.String |
expandIndexedPlaceholders(java.lang.String expString,
java.lang.String[] values,
boolean retainMissingPlaceholders)
Expand indexed placeholders with their corresponding values. |
static java.lang.String |
expandNamedPlaceholders(java.lang.String expString,
java.util.Map<java.lang.String,java.lang.Object> values)
Expand named placeholders with their corresponding values from the map. |
static java.lang.String |
expandNamedPlaceholders(java.lang.String expString,
java.util.Map<java.lang.String,java.lang.Object> values,
boolean retainMissingPlaceholders)
Expand named placeholders with their corresponding values from the map. |
static java.lang.String |
expandNamedPlaceholdersWithBean(java.lang.String expString,
java.lang.Object beanContext,
boolean retainMissingPlaceholders)
Expand named placeholders with their corresponding values from a bean instance. |
static java.lang.String |
getCheckBoxValue(javax.servlet.http.HttpServletRequest request,
java.lang.String paramName)
This method returns the request value of a checkbox item. |
static java.lang.String |
getControllerPath()
Returns the path to the controller servlet ( including the context if one is being used). |
static java.lang.String |
getDotDelimitedPropertyName(DataSource ds,
TCEntity entity,
java.lang.String propertyName)
Returns the dot delimited property name eg. |
static java.lang.String |
getDotDelimitedPropertyName(java.lang.String dsn,
java.lang.String rowID,
java.lang.String propertyName)
Returns the dot delimited property name eg. |
static java.lang.String |
getDotDelimitedTerm(int termNum,
java.lang.String parameter)
Returns a term of a dot delimited string. |
static java.lang.String |
getExplicitDSN(java.lang.String str)
Gets the explicit DSN from a string such as "save(customers)". |
static java.lang.String |
getFormattedValue(java.lang.String dsn,
java.lang.String propertyName,
Model model,
java.lang.Object obj,
java.lang.String format,
java.lang.String type)
Returns the value formatted with the specified format string. |
static java.text.Format |
getFormatter(java.util.Locale locale,
java.lang.String format,
java.lang.String type)
Gets a formatter for the named type and format specifier |
static java.lang.String |
getJSCalendarFormat(java.lang.String dsn,
java.lang.String propertyName)
Gets a format string compatible with the JS calendar control for the specified dsn and property. |
static int |
getNamedScopeKey(java.lang.String scopeName)
|
static java.lang.String |
getPageName(javax.servlet.http.HttpServletRequest request)
Gets the response page name for the current request. |
static java.util.List<java.lang.String> |
getPropertyList(java.util.Collection<?> collection,
java.lang.String propertyName)
Returns a list of the toString() values from the named property on the instances of the items in the collection. |
static java.lang.String |
getPropertyName(java.lang.String parameter)
Gets property name from a parameter, where property name is assumed to be the third token in the parameter, and the parameter is delimited by '.' characters. |
static java.lang.String |
getQualifier(java.lang.String qualifiedName)
Returns the qualifier ( such as the package name ) from the qualified name |
static java.lang.String |
getRandomString(int size)
Returns a random text string of the specified size |
static java.lang.String |
getRealClassName(java.lang.Object obj)
Gets the real classname for the specified object that maybe a proxy |
static java.lang.String |
getRequestAction(java.lang.String str)
Gets the Action name from a actionName string such as "save(customers)". |
static java.lang.String |
getRowID(java.lang.String parameter)
Gets row ID from a parameter, where row ID is assumed to be the second token in the parameter, and the parameter is delimited by the '.' character. |
static java.lang.String |
getStackTraceAsString(java.lang.Throwable exception)
Converts the stack trace of a Throwable instance to a String. |
static java.lang.String |
getUnqualifiedName(java.lang.String qualifiedName)
Returns the unqualified property or class name |
static java.lang.String |
getURLSansQueryString(java.lang.String url)
Gets the url without the query string |
static boolean |
isEmpty(java.lang.String str)
Returns true if the string is null, or has a length == 0. |
static boolean |
isNamedScopeKey(java.lang.String scopeName)
|
static boolean |
isNameInWildCardList(java.lang.String name,
java.util.List<java.lang.String> list)
|
static boolean |
isNotEmpty(java.lang.String str)
Returns true if the string is not null, and has a length greater than 0. |
static boolean |
isQuoted(java.lang.String string)
Returns true if the string is quoted. |
static java.util.List<java.lang.String> |
lineToList(java.lang.String line)
Converts a comma-separated string into a List |
static java.util.Map<java.lang.String,java.lang.String> |
lineToMap(java.lang.String line)
Converts a comma-separated string of name-value pairs of the form name1:value1,name2:value2,nameN:valueN into a map |
static byte[] |
objectToByteArray(java.lang.Object obj)
Converts an object to a byte array |
static java.lang.String |
removeDoubleSlashes(java.lang.String text)
|
static java.lang.String |
removeExpressionComments(java.lang.String expressionString)
|
static java.lang.String |
RGBtoHex(int r,
int g,
int b)
The name says it all. |
static java.lang.String |
toBeanGetterName(java.lang.String basicName)
Converts the basic method name to a getter method name. |
static java.lang.String |
toHexString(byte[] block)
Converts a byte array to hex string. |
static java.lang.String |
toHexString(java.lang.String str)
Converts a byte array to hex string. |
static java.lang.String |
toTitleCase(java.lang.String str)
Convert separate words to title case |
static boolean |
wildCardMatch(java.lang.String input,
java.lang.String wildcardString)
Tests the input string for a match with the wildcardString pattern. |
static java.lang.String |
wordWrap(java.lang.String str,
int length)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DSN_TERM
public static final int ROWID_TERM
public static final int FIELDNAME_TERM
public static java.util.Map<java.lang.String,java.lang.Integer> namedScopes
| Constructor Detail |
|---|
public Text()
| Method Detail |
|---|
public static int getNamedScopeKey(java.lang.String scopeName)
public static boolean isNamedScopeKey(java.lang.String scopeName)
public static void addAttribute(java.lang.StringBuilder sb,
java.lang.String attributeName,
java.lang.String value)
sb - the StringBuilder to write the results intoattributeName - the attribute name to createvalue - the value to set to the attribute name topublic static java.lang.String escapeHTML(java.lang.String text)
text -
public static java.lang.String escapeXML(java.lang.String text)
text -
public static java.lang.String escapeQuotes(java.lang.String src)
src - the string to escape
public static java.lang.String escapeSingleQuotes(java.lang.String str)
str - the string to escape
public static java.lang.String escapeSQL(java.lang.String str)
str - the string to escape
public static void appendQuotedString(java.lang.StringBuffer sb,
java.lang.String s,
java.lang.String comma)
public static void appendQuotedString(java.lang.StringBuffer sb,
java.lang.String s)
public static java.lang.String getStackTraceAsString(java.lang.Throwable exception)
exception - The Throwable instance.
public static java.lang.String getFormattedValue(java.lang.String dsn,
java.lang.String propertyName,
Model model,
java.lang.Object obj,
java.lang.String format,
java.lang.String type)
throws java.lang.Exception
java.lang.Exception - NumberFormatException, or ParseExceptiondsn - the data source namepropertyName - the field namemodel - the model objectobj - the object to be formattedformat - the format specifiertype - the field type
public static java.lang.String getPageName(javax.servlet.http.HttpServletRequest request)
request - the current request
public static java.lang.String getDotDelimitedTerm(int termNum,
java.lang.String parameter)
termNum - the term number to retrieveparameter - the dot delimited string
public static java.lang.String toBeanGetterName(java.lang.String basicName)
basicName - the basic name
public static java.lang.String toTitleCase(java.lang.String str)
str -
public static java.lang.String getCheckBoxValue(javax.servlet.http.HttpServletRequest request,
java.lang.String paramName)
request - the request objectparamName - the checkbox's parameter name
public static java.lang.String expandExpressions(java.lang.String expString,
com.taggercat.el.ELPropertyResolver elProperrtResolver,
com.taggercat.el.ELContext elContext)
throws com.taggercat.el.ParseException
com.taggercat.el.ParseExceptionexpString - the string containing the expressionselProperrtResolver - the expression term provider
public static boolean isQuoted(java.lang.String string)
string - the string to test
public static boolean isNotEmpty(java.lang.String str)
str -
public static boolean isEmpty(java.lang.String str)
str -
public static java.lang.String getDotDelimitedPropertyName(DataSource ds,
TCEntity entity,
java.lang.String propertyName)
ds - the data source nameentity - the tcEntitypropertyName - the property Name
public static java.lang.String getDotDelimitedPropertyName(java.lang.String dsn,
java.lang.String rowID,
java.lang.String propertyName)
dsn - the data source namerowID - the row IDpropertyName - the property name
public static boolean wildCardMatch(java.lang.String input,
java.lang.String wildcardString)
input string for a match with the wildcardString pattern.
Patterns roughly follow DOS wildcard patterns, where a ? matches any character,
and a * matches to the end of the string. The match is not case sensitive.
input - the string to test against the patternwildcardString - the wildcard string pattern to match
public static java.lang.String toHexString(byte[] block)
block - the bytes to convert
public static java.lang.String toHexString(java.lang.String str)
str - the string to convert
public static boolean equalStrings(java.lang.String s1,
java.lang.String s2)
s1 - s2 -
public static java.lang.String getRequestAction(java.lang.String str)
str - the request name, possibly with an embedded data source name
public static java.lang.String getExplicitDSN(java.lang.String str)
str - the request name, possibly with an embedded data source name
public static java.util.List<java.lang.String> lineToList(java.lang.String line)
line - the string of comma separated items
public static java.util.Map<java.lang.String,java.lang.String> lineToMap(java.lang.String line)
line - the string of comma separated items
public static java.text.Format getFormatter(java.util.Locale locale,
java.lang.String format,
java.lang.String type)
locale - the localeformat - the named format or format patterntype - the type
public static java.lang.String expandIndexedPlaceholders(java.lang.String expString,
java.util.List<?> values)
expString - the string to expandvalues - the placeholder values
public static java.lang.String expandIndexedPlaceholders(java.lang.String expString,
java.lang.String[] values)
expString - the string to expandvalues - the placeholder values
public static java.lang.String expandIndexedPlaceholders(java.lang.String expString,
java.lang.String[] values,
boolean retainMissingPlaceholders)
expString - the string to expandvalues - the placeholder valuesretainMissingPlaceholders - set true to retain non-matched placeholders
public static java.lang.String expandIndexedPlaceholders(java.lang.String expString,
java.util.List<?> values,
boolean retainMissingPlaceholders)
expString - the string to expandvalues - the placeholder valuesretainMissingPlaceholders - set true to retain non-matched placeholders
public static java.lang.String expandNamedPlaceholders(java.lang.String expString,
java.util.Map<java.lang.String,java.lang.Object> values)
expString - the string to expandvalues - the placeholder values
public static java.lang.String expandNamedPlaceholders(java.lang.String expString,
java.util.Map<java.lang.String,java.lang.Object> values,
boolean retainMissingPlaceholders)
expString - the string to expandvalues - the placeholder valuesretainMissingPlaceholders - set true to retain non-matched placeholders
public static java.lang.String expandNamedPlaceholdersWithBean(java.lang.String expString,
java.lang.Object beanContext,
boolean retainMissingPlaceholders)
expString - the string to expandbeanContext - the bean context to get value fromretainMissingPlaceholders - set true to retain non-matched placeholders
public static java.util.List<java.lang.String> delimitedStringToList(java.lang.String delimitedString)
delimitedString - delimited with comma, semicolon, or a forward slash
public static java.util.Map<java.lang.String,java.lang.String> delimitedStringToMap(java.lang.String delimitedString)
delimitedString - delimited with comma, semi-colon, or a forward slash
public static java.lang.String getPropertyName(java.lang.String parameter)
parameter - Parameter from which to extract field name.
public static java.lang.String getRowID(java.lang.String parameter)
parameter - Parameter from which to extract row ID.
public static java.lang.String getURLSansQueryString(java.lang.String url)
url -
public static byte[] objectToByteArray(java.lang.Object obj)
obj - the Object to be converted
public static java.lang.Object byteArrayToObject(byte[] objByteArray)
public static java.lang.String convertNameToCaption(java.lang.String name)
public static java.lang.String getQualifier(java.lang.String qualifiedName)
qualifiedName -
public static java.lang.String getUnqualifiedName(java.lang.String qualifiedName)
qualifiedName -
public static java.util.List<java.lang.String> getPropertyList(java.util.Collection<?> collection,
java.lang.String propertyName)
collection - propertyName -
public static java.lang.String getRandomString(int size)
size - - the size
public static java.lang.String wordWrap(java.lang.String str,
int length)
public static java.lang.String getControllerPath()
public static java.lang.String getRealClassName(java.lang.Object obj)
public static boolean isNameInWildCardList(java.lang.String name,
java.util.List<java.lang.String> list)
public static java.lang.String encryptPassword(java.lang.String password)
public static java.lang.String removeExpressionComments(java.lang.String expressionString)
public static java.lang.String convertCRLFToHRMLBreak(java.lang.String text)
public static java.lang.String removeDoubleSlashes(java.lang.String text)
public static java.lang.String convertJSPToAlias(java.lang.String jspfileName)
public static java.lang.String getJSCalendarFormat(java.lang.String dsn,
java.lang.String propertyName)
dsn - the data source namepropertyName - the property name
public static java.lang.String convertJavaToJSCalFormatPattern(java.lang.String javaFormatPattern)
javaFormatPattern - - the Java format string
public static java.lang.String escapeRegExChars(java.lang.String raw)
raw - the source text
public static java.lang.String RGBtoHex(int r,
int g,
int b)
r - g - b -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||