public final class StringUtil extends Object
Modifier and Type | Class and Description |
---|---|
static class |
StringUtil.StringIterator<T> |
Modifier and Type | Field and Description |
---|---|
static int |
DB_MAX_STRING_LENGTH
Note:
String.length() counts Unicode supplementary
characters twice, so for a String consisting only of those,
the limit is effectively MAX_LONG_STRING_LENGTH / 2 |
Constructor and Description |
---|
StringUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
fromBytes(byte[] bytes)
Converts a byte array into a string using the current process engines default charset as
returned by
ProcessEngineConfigurationImpl.getDefaultCharset() . |
static String |
fromBytes(byte[] bytes,
ProcessEngine processEngine)
Converts a byte array into a string using the current process engines default charset as
returned by
ProcessEngineConfigurationImpl.getDefaultCharset() . |
static boolean |
hasAnySuffix(String text,
String[] suffixes) |
static boolean |
hasText(String string) |
static boolean |
isCompositeExpression(String text,
ExpressionManager expressionManager)
Checks whether a
String seams to be a composite expression or not. |
static boolean |
isExpression(String text)
Checks whether a
String seams to be an expression or not
Note: In most cases you should check for composite expressions. |
static String |
join(Iterator<String> iterator) |
static String |
joinDbEntityIds(Collection<? extends DbEntity> dbEntities) |
static String |
joinProcessElementInstanceIds(Collection<? extends ProcessElementInstance> processElementInstances) |
static Reader |
readerFromBytes(byte[] bytes) |
static String[] |
split(String text,
String regex) |
static byte[] |
toByteArray(String string)
Gets the bytes from a string using the current process engine's default charset
|
static byte[] |
toByteArray(String string,
ProcessEngine processEngine)
Gets the bytes from a string using the provided process engine's default charset
|
static String |
trimToMaximumLengthAllowed(String string)
Trims the input to the
maxium length allowed for persistence with our default database schema |
static Writer |
writerForStream(OutputStream outStream) |
public static int DB_MAX_STRING_LENGTH
String.length()
counts Unicode supplementary
characters twice, so for a String consisting only of those,
the limit is effectively MAX_LONG_STRING_LENGTH / 2public static boolean isExpression(String text)
String
seams to be an expression or not
Note: In most cases you should check for composite expressions. See
isCompositeExpression(String, ExpressionManager)
for more information.text
- the text to checkpublic static boolean isCompositeExpression(String text, ExpressionManager expressionManager)
String
seams to be a composite expression or not. In contrast to an eval expression
is the composite expression also allowed to consist of a combination of literal and eval expressions, e.g.,
"Welcome ${customer.name} to our site".
Note: If you just want to allow eval expression, then the expression must always start with "#{" or "${".
Use isExpression(String)
to conduct these kind of checks.public static String fromBytes(byte[] bytes)
ProcessEngineConfigurationImpl.getDefaultCharset()
. The converted string
is empty if the provided byte array is empty or null
.bytes
- the byte arraynull
public static String fromBytes(byte[] bytes, ProcessEngine processEngine)
ProcessEngineConfigurationImpl.getDefaultCharset()
. The converted string
is empty if the provided byte array is empty or null
.bytes
- the byte arrayprocessEngine
- the process enginenull
public static Reader readerFromBytes(byte[] bytes)
public static Writer writerForStream(OutputStream outStream)
public static byte[] toByteArray(String string)
string
- the string to get the bytes formpublic static byte[] toByteArray(String string, ProcessEngine processEngine)
string
- the string to get the bytes formprocessEngine
- the process engine to usepublic static String trimToMaximumLengthAllowed(String string)
maxium length allowed
for persistence with our default database schemastring
- the input that might be trimmed if maximum length is exceededDB_MAX_STRING_LENGTH
public static String joinDbEntityIds(Collection<? extends DbEntity> dbEntities)
public static String joinProcessElementInstanceIds(Collection<? extends ProcessElementInstance> processElementInstances)
public static boolean hasText(String string)
string
- the String to check.TRUE
if the String is not null and not empty. FALSE
otherwise.Copyright © 2021. All rights reserved.