|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.datatools.connectivity.oda.util.StringSubstitutionUtil
public final class StringSubstitutionUtil
StringSubstitutionUtil is a general utility that any ODA provider can use, which performs string substitutions. The utility is designed for ODA data sources that has a concept of embedded delimited strings in text strings. For example, an ODA driver query text could contain embedded parameters in the form of a colon followed by a parameter name, like ":myVariable". Two forms of string substitutions are supported by the utility: subsitution by index or by name.
Method Summary | |
---|---|
static int |
getDelimitedStringCount(java.lang.String text,
java.lang.String startDelimiter)
Returns the number of named and un-named delimited strings in the text argument, where the delimited strings are labeled by only a start delimiter. |
static int |
getDelimitedStringCount(java.lang.String text,
java.lang.String startDelimiter,
boolean requiresNamedDelimiters)
Returns the number of delimited strings in the text argument, where the delimited strings are labeled by only a start delimiter. |
static int |
getDelimitedStringCount(java.lang.String text,
java.lang.String startDelimiter,
java.lang.String endDelimiter)
Returns the number of named and un-named delimited strings in the text argument, where the delimited strings are labeled by a start delimiter and an end delimiter. |
static int |
getDelimitedStringCount(java.lang.String text,
java.lang.String startDelimiter,
java.lang.String endDelimiter,
boolean requiresNamedDelimiters)
Returns the number of delimited strings in the text argument, where the delimited strings are labeled by a start delimiter and an end delimiter. |
static void |
resetLogger()
Resets the StringSubstitutionUtil logger. |
static void |
setLogger(java.util.logging.Logger logger)
Sets the StringSubstitutionUtil logger to log its
utility methods. |
static java.lang.String |
substituteByIndex(java.lang.String text,
java.lang.String startDelimiter,
java.util.List substitutionList)
Performs string substitution based on index, where the delimited strings are labeled by only a start delimiter. |
static java.lang.String |
substituteByIndex(java.lang.String text,
java.lang.String startDelimiter,
java.lang.String endDelimiter,
java.util.List substitutionList)
Performs string substitution based on index, where the delimited strings are labeled by a start delimiter and an end delimiter. |
static java.lang.String |
substituteByName(java.lang.String text,
java.lang.String startDelimiter,
java.util.Map nameValues)
Performs string substitution based on name, where the delimited strings are labeled by only a start delimiter. |
static java.lang.String |
substituteByName(java.lang.String text,
java.lang.String startDelimiter,
java.lang.String endDelimiter,
java.util.Map nameValues)
Performs string substitution based on name, where the delimited strings are labeled by a start delimiter and an end delimiter. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void setLogger(java.util.logging.Logger logger)
StringSubstitutionUtil
logger to log its
utility methods.
logger
- the logger that StringSubstitutionUti
uses to log its methods.public static void resetLogger()
StringSubstitutionUtil
logger. The caller
of setLogger
should call this to remove its logger from
the StringSubstituionUtil
. Otherwise, subsequent calls
to this utility's methods by other callers may be logged in the
set logger.
public static int getDelimitedStringCount(java.lang.String text, java.lang.String startDelimiter)
getDelimitedStringCount( text, startDelimiter, false )
.
text
- string containing delimited strings.startDelimiter
- the start delimiter string.
getDelimitedStringCount
public static int getDelimitedStringCount(java.lang.String text, java.lang.String startDelimiter, boolean requiresNamedDelimiters)
requiresNamedDelimiters
is set to true, only the named delimiters will be counted. This should be used when
the caller wants to perform substitution by name on the text string. Otherwise, both named
and un-named delimiters will be counted. This should be used when the caller wants
to perform substitution by index on the text string.
text
- string containing delimited strings.startDelimiter
- the start delimiter string.requiresNamedDelimiters
- determines whether only named delimiters will be counted.
java.lang.NullPointerException
- if text or startDelimiter is null
.public static int getDelimitedStringCount(java.lang.String text, java.lang.String startDelimiter, java.lang.String endDelimiter)
getDelimitedStringCount( text, startDelimiter, endDelimiter, false )
.
text
- string containing delimited strings.startDelimiter
- the start delimiter string.endDelimiter
- the end delimiter string.
getDelimitedStringCount
public static int getDelimitedStringCount(java.lang.String text, java.lang.String startDelimiter, java.lang.String endDelimiter, boolean requiresNamedDelimiters)
requiresNamedDelimiters
is set to true, only the named delimiters will be counted. This should be used when
the caller wants to perform substitution by name on the text string. Otherwise, both named
and un-named delimiters will be counted. This should be used when the caller wants
to perform substitution by index on the text string.
text
- string containing delimited strings.startDelimiter
- the start delimiter string.endDelimiter
- the end delimiter string.requiresNamedDelimiters
- determines whether only named delimiters will be counted.
java.lang.NullPointerException
- if text, startDelimiter, or endDelimiter
is null
.public static java.lang.String substituteByIndex(java.lang.String text, java.lang.String startDelimiter, java.util.List substitutionList)
text
- text string containing delimited strings.startDelimiter
- the start delimiter string.substitutionList
- list of substitution values for the delimited strings.
java.lang.NullPointerException
- if text, startDelimiter, or substitutionList
is null
.public static java.lang.String substituteByIndex(java.lang.String text, java.lang.String startDelimiter, java.lang.String endDelimiter, java.util.List substitutionList)
text
- text string containing delimited strings.startDelimiter
- the start delimiter string.endDelimiter
- the end delimiter string.substitutionList
- list of substitution values for the delimited strings.
java.lang.NullPointerException
- if text, startDelimiter, endDelimiter, or
substitutionList is null
.public static java.lang.String substituteByName(java.lang.String text, java.lang.String startDelimiter, java.util.Map nameValues)
text
- text string containing delimited strings.startDelimiter
- the start delimiter string.nameValues
- map of substitution name-value pairs.
java.lang.NullPointerException
- if text, startDelimiter, or nameValues is
null
.public static java.lang.String substituteByName(java.lang.String text, java.lang.String startDelimiter, java.lang.String endDelimiter, java.util.Map nameValues)
text
- text string containing delimited strings.startDelimiter
- the start delimiter string.endDelimiter
- the end delimiter string.nameValues
- map of substitution name-value pairs.
java.lang.NullPointerException
- if text, startDelimiter, endDelimiter, or
nameValues is null
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |