Top Description Fields Constructors Methods
org.hibernate.validator.internal.util

public Class StringHelper

extends Object
Class Inheritance
Imports
java.lang.reflect.Field, .Member, .Method, .ParameterizedType, .Type, java.util.Arrays, .Locale, java.util.regex.Pattern, java.util.stream.Collectors

Helper class dealing with strings.
Author
Gunnar Morling

Field Summary

Modifier and TypeField and Description
private static final Pattern

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static String

Returns:

the given string, decapitalized. null is returned if null is passed as input; An empty string is returned if an empty string is passed as input
decapitalize
(String
the string to decapitalize
string
)

Returns the given string, with its first letter changed to lower-case unless the string starts with more than one upper-case letter, in which case the string will be returned unaltered.

public static String
format(String format, Object... args)

public static boolean

Returns:

true if the string is null or only contains whitespaces
isNullOrEmptyString
(String
the string considered
value
)

Indicates if the string is null or is empty ie only contains whitespaces.

public static String

Returns:

a string made up of the string representations of the given array's members, separated by the given separator string
join
(Object[]
the array to join
array
,
String
the separator string
separator
)

Joins the elements of the given array to a string, separated by the given separator string.

public static String

Returns:

a string made up of the string representations of the given iterable members, separated by the given separator string
join
(Iterable<?>
the iterable to join
iterable
,
String
the separator string
separator
)

Joins the elements of the given iterable to a string, separated by the given separator string.

private static boolean
public static String
toShortString(Member member)

Creates a compact string representation of the given member, useful for debugging or toString() methods.

private static String
private static String
public static String
toShortString(Type type)

Creates a compact string representation of the given type, useful for debugging or toString() methods.

private static String
private static String
toShortString(ParameterizedType parameterizedType)

private static String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DOTback to summary
private static final Pattern DOT

Constructor Detail

StringHelperback to summary
private StringHelper()

Method Detail

decapitalizeback to summary
public static String decapitalize(String string)

Returns the given string, with its first letter changed to lower-case unless the string starts with more than one upper-case letter, in which case the string will be returned unaltered.

Provided to avoid a dependency on the java.beans.Introspector API which is not available on the Android platform (HV-779).

Parameters
string:String

the string to decapitalize

Returns:String

the given string, decapitalized. null is returned if null is passed as input; An empty string is returned if an empty string is passed as input

See Also
java.beans.Introspector#decapitalize(String)
formatback to summary
public static String format(String format, Object... args)
isNullOrEmptyStringback to summary
public static boolean isNullOrEmptyString(String value)

Indicates if the string is null or is empty ie only contains whitespaces.

Parameters
value:String

the string considered

Returns:boolean

true if the string is null or only contains whitespaces

joinback to summary
public static String join(Object[] array, String separator)

Joins the elements of the given array to a string, separated by the given separator string.

Parameters
array:Object[]

the array to join

separator:String

the separator string

Returns:String

a string made up of the string representations of the given array's members, separated by the given separator string

joinback to summary
public static String join(Iterable<?> iterable, String separator)

Joins the elements of the given iterable to a string, separated by the given separator string.

Parameters
iterable:Iterable<?>

the iterable to join

separator:String

the separator string

Returns:String

a string made up of the string representations of the given iterable members, separated by the given separator string

startsWithSeveralUpperCaseLettersback to summary
private static boolean startsWithSeveralUpperCaseLetters(String string)
toShortStringback to summary
public static String toShortString(Member member)

Creates a compact string representation of the given member, useful for debugging or toString() methods. Package names are shortened, e.g. "org.hibernate.validator.internal.engine" becomes "o.h.v.i.e". Not to be used for user-visible log messages.

toShortStringback to summary
private static String toShortString(Field field)
toShortStringback to summary
private static String toShortString(Method method)
toShortStringback to summary
public static String toShortString(Type type)

Creates a compact string representation of the given type, useful for debugging or toString() methods. Package names are shortened, e.g. "org.hibernate.validator.internal.engine" becomes "o.h.v.i.e". Not to be used for user-visible log messages.

toShortStringback to summary
private static String toShortString(Class<?> type)
toShortStringback to summary
private static String toShortString(ParameterizedType parameterizedType)
toShortStringback to summary
private static String toShortString(Package pakkage)