Package org.hibernate.util
Class StringHelper
java.lang.Object
org.hibernate.util.StringHelper
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic String[]static booleanbooleanValue(String tfString) static StringCollapses a name.static StringcollapseQualifier(String qualifier, boolean includeDots) Given a qualifier, collapse it.static StringcollapseQualifierBase(String name, String qualifierBase) Cross betweencollapse(java.lang.String)andpartiallyUnqualify(java.lang.String, java.lang.String).static intcountUnquoted(String string, char character) static intfirstIndexOfChar(String sqlString, String string, int startindex) static StringgenerateAlias(String description) static StringgenerateAlias(String description, int unique) Generate a nice alias for the given class name or collection role name and unique integer.static charstatic charstatic booleanstatic booleanisNotEmpty(String string) static booleanDetermine if the given string is quoted (wrapped by '`' characters at beginning and end).static booleanDetermine if the given name is quoted.static Stringstatic Stringstatic intlastIndexOfLetter(String string) static int[]locateUnquoted(String string, char character) static StringmoveAndToBeginning(String filter) static String[]static StringpartiallyUnqualify(String name, String qualifierBase) Partially unqualifies a qualified name.static Stringstatic Stringstatic String[]static StringReturn a representation of the given name ensuring quoting (wrapped with '`' characters).static Stringrepeat(char character, int times) static Stringstatic String[]static Stringstatic Stringstatic Stringreplace(String template, String placeholder, String replacement, boolean wholeWords, boolean encloseInParensIfNecessary) static Stringreplace(String beforePlaceholder, String afterPlaceholder, String placeholder, String replacement, boolean wholeWords, boolean encloseInParensIfNecessary) static StringreplaceOnce(String template, String placeholder, String replacement) static Stringstatic String[]static String[]static String[]static StringtoLowerCase(String str) static Stringstatic StringtoUpperCase(String str) static Stringstatic Stringstatic StringunqualifyEntityName(String entityName) static StringReturn the unquoted version of name (stripping the start and end '`' characters if present).static String[]Return the unquoted version of name stripping the start and end quote characters.static StringReturn the unquoted version of name stripping the start and end quote characters.static String
-
Field Details
-
WHITESPACE
- See Also:
-
-
Method Details
-
lastIndexOfLetter
-
join
-
join
-
add
-
repeat
-
repeat
-
replace
-
replace
-
replace
-
replace
-
replace
-
getLastNonWhitespaceCharacter
-
getFirstNonWhitespaceCharacter
-
replaceOnce
-
split
-
split
-
unqualify
-
qualifier
-
collapse
Collapses a name. Mainly intended for use with classnames, where an example might serve best to explain. Imagine you have a class named 'org.hibernate.util.StringHelper'; calling collapse on that classname will result in 'o.h.u.StringHelper'.- Parameters:
name- The name to collapse.- Returns:
- The collapsed name.
-
collapseQualifier
Given a qualifier, collapse it.- Parameters:
qualifier- The qualifier to collapse.includeDots- Should we include the dots in the collapsed form?- Returns:
- The collapsed form.
-
partiallyUnqualify
Partially unqualifies a qualified name. For example, with a base of 'org.hibernate' the name 'org.hibernate.util.StringHelper' would become 'util.StringHelper'.- Parameters:
name- The (potentially) qualified name.qualifierBase- The qualifier base.- Returns:
- The name itself, or the partially unqualified form if it begins with the qualifier base.
-
collapseQualifierBase
Cross betweencollapse(java.lang.String)andpartiallyUnqualify(java.lang.String, java.lang.String). Functions much likecollapse(java.lang.String)except that only the qualifierBase is collapsed. For example, with a base of 'org.hibernate' the name 'org.hibernate.util.StringHelper' would become 'o.h.util.StringHelper'.- Parameters:
name- The (potentially) qualified name.qualifierBase- The qualifier base.- Returns:
- The name itself if it does not begin with the qualifierBase, or the properly collapsed form otherwise.
-
suffix
-
root
-
unroot
-
booleanValue
-
toString
-
multiply
-
countUnquoted
-
locateUnquoted
-
isNotEmpty
-
isEmpty
-
qualify
-
qualify
-
firstIndexOfChar
-
truncate
-
generateAlias
-
generateAlias
Generate a nice alias for the given class name or collection role name and unique integer. Subclasses of Loader do not have to use aliases of this form.- Parameters:
description- The base name (usually an entity-name or collection-role)unique- A uniquing value- Returns:
- an alias of the form foo1_
-
unqualifyEntityName
-
toUpperCase
-
toLowerCase
-
moveAndToBeginning
-
isQuoted
Determine if the given string is quoted (wrapped by '`' characters at beginning and end).- Parameters:
name- The name to check.- Returns:
- True if the given string starts and ends with '`'; false otherwise.
-
quote
Return a representation of the given name ensuring quoting (wrapped with '`' characters). If already wrapped return name.- Parameters:
name- The name to quote.- Returns:
- The quoted version.
-
unquote
Return the unquoted version of name (stripping the start and end '`' characters if present).- Parameters:
name- The name to be unquoted.- Returns:
- The unquoted version.
-
isQuoted
Determine if the given name is quoted. It is considered quoted if either:- starts AND ends with backticks (`)
- starts with dialect-specified
open-quoteAND ends with dialect-specifiedclose-quote
- Parameters:
name- The name to checkdialect- The dialect (to determine the "real" quoting chars).- Returns:
- True if quoted, false otherwise
-
unquote
Return the unquoted version of name stripping the start and end quote characters.- Parameters:
name- The name to be unquoted.dialect- The dialect (to determine the "real" quoting chars).- Returns:
- The unquoted version.
-
unquote
Return the unquoted version of name stripping the start and end quote characters.- Parameters:
names- The names to be unquoted.dialect- The dialect (to determine the "real" quoting chars).- Returns:
- The unquoted versions.
-