Package org.openremote.model.util
Class TextUtil
java.lang.Object
org.openremote.model.util.TextUtil
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Pattern
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int
convertPollingIntervalString
(String pollingInterval) Converts a String which represents a pollingInterval into an int which can be used as delay for Thread.sleep();static String
static String[]
fromCommaSeparated
(String commaWords) static <T extends Enum<T>>
TgetEnumFromString
(Class<T> c, String string) Get an enum value from a string without throwing exception.static boolean
isNullOrEmpty
(String str) static String
static String
static String
requireNonNullAndNonEmpty
(String str, String exceptionMessage) static String
toCommaSeparated
(String... strings) static String
static String
toLowerCaseDash
(String camelCase) TransformsEXFooBar123
intoex-foo-bar-123
andattributeX
intoattribute-x
without regex.static String
static String
toProperCase
(String s, boolean convertUnderscoreToSpace) static String
static String
-
Field Details
-
REGEXP_PATTERN_INTEGER
- See Also:
-
REGEXP_PATTERN_INTEGER_POSITIVE
- See Also:
-
REGEXP_PATTERN_INTEGER_NEGATIVE
- See Also:
-
REGEXP_PATTERN_INTEGER_NON_ZERO
- See Also:
-
REGEXP_PATTERN_INTEGER_POSITIVE_NON_ZERO
- See Also:
-
REGEXP_PATTERN_INTEGER_NEGATIVE_NON_ZERO
- See Also:
-
REGEXP_PATTERN_DOUBLE
- See Also:
-
REGEXP_PATTERN_DOUBLE_POSITIVE
- See Also:
-
REGEXP_PATTERN_DOUBLE_NEGATIVE
- See Also:
-
REGEXP_PATTERN_DOUBLE_NON_ZERO
- See Also:
-
REGEXP_PATTERN_DOUBLE_POSITIVE_NON_ZERO
- See Also:
-
REGEXP_PATTERN_DOUBLE_NEGATIVE_NON_ZERO
- See Also:
-
REGEXP_PATTERN_BASIC_HTTP_URL
- See Also:
-
REGEXP_PATTERN_STRING_NON_EMPTY
- See Also:
-
REGEXP_PATTERN_STRING_NON_EMPTY_NO_WHITESPACE
- See Also:
-
REGEXP_INTEGER_POSITIVE
-
INTEGER_POSITIVE_VALIDATOR
-
REGEXP_PATTERN_CRON_EXPRESSION
- See Also:
-
-
Constructor Details
-
TextUtil
public TextUtil()
-
-
Method Details
-
convertPollingIntervalString
Converts a String which represents a pollingInterval into an int which can be used as delay for Thread.sleep();Following conversion will happen:
null || "" = -1
500 = 500
1s = 1000 * 1 = 1000
1m = 1000 * 60 = 60000
1h = 1000 * 60 * 60 = 3600000- Parameters:
pollingInterval
- interval string, such as '1m' as millisecond value- Returns:
- interval in milliseconds
-
toCommaSeparated
-
fromCommaSeparated
-
getEnumFromString
Get an enum value from a string without throwing exception. Enum should be in uppercase to use this method. -
toLowerCaseDash
TransformsEXFooBar123
intoex-foo-bar-123
andattributeX
intoattribute-x
without regex. -
ellipsize
-
pad
-
truncate
-
isNullOrEmpty
-
asNonNullAndNonEmpty
-
requireNonNullAndNonEmpty
-
requireNonNullAndNonEmpty
-
toLowerCamelCase
-
toUpperCamelCase
-
toProperCase
-
toProperCase
-
asInteger
-