Package org.camunda.bpm.engine.impl.util
Class StringUtil
java.lang.Object
org.camunda.bpm.engine.impl.util.StringUtil
- Author:
- Sebastian Menski
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic int
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
fromBytes
(byte[] bytes) Converts a byte array into a string using the current process engines default charset as returned byProcessEngineConfigurationImpl.getDefaultCharset()
.static String
fromBytes
(byte[] bytes, ProcessEngine processEngine) Converts a byte array into a string using the current process engines default charset as returned byProcessEngineConfigurationImpl.getDefaultCharset()
.static boolean
hasAnySuffix
(String text, String[] suffixes) static boolean
static boolean
isCompositeExpression
(String text, ExpressionManager expressionManager) Checks whether aString
seams to be a composite expression or not.static boolean
isExpression
(String text) Checks whether aString
seams to be an expression or not Note: In most cases you should check for composite expressions.static String
static String
joinDbEntityIds
(Collection<? extends DbEntity> dbEntities) static String
joinProcessElementInstanceIds
(Collection<? extends ProcessElementInstance> processElementInstances) static Reader
readerFromBytes
(byte[] bytes) static String[]
static byte[]
toByteArray
(String string) Gets the bytes from a string using the current process engine's default charsetstatic byte[]
toByteArray
(String string, ProcessEngine processEngine) Gets the bytes from a string using the provided process engine's default charsetstatic String
trimToMaximumLengthAllowed
(String string) Trims the input to themaxium length allowed
for persistence with our default database schemastatic Writer
writerForStream
(OutputStream outStream)
-
Field Details
-
DB_MAX_STRING_LENGTH
public static int DB_MAX_STRING_LENGTHNote: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 Details
-
StringUtil
public StringUtil()
-
-
Method Details
-
isExpression
Checks whether aString
seams to be an expression or not Note: In most cases you should check for composite expressions. SeeisCompositeExpression(String, ExpressionManager)
for more information.- Parameters:
text
- the text to check- Returns:
- true if the text seams to be an expression false otherwise
-
isCompositeExpression
Checks whether aString
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 "${". UseisExpression(String)
to conduct these kind of checks. -
split
-
hasAnySuffix
-
fromBytes
Converts a byte array into a string using the current process engines default charset as returned byProcessEngineConfigurationImpl.getDefaultCharset()
. The converted string is empty if the provided byte array is empty ornull
.- Parameters:
bytes
- the byte array- Returns:
- a string representing the bytes, empty String if byte array is
null
-
fromBytes
Converts a byte array into a string using the current process engines default charset as returned byProcessEngineConfigurationImpl.getDefaultCharset()
. The converted string is empty if the provided byte array is empty ornull
.- Parameters:
bytes
- the byte arrayprocessEngine
- the process engine- Returns:
- a string representing the bytes, empty String if byte array is
null
-
readerFromBytes
-
writerForStream
-
toByteArray
Gets the bytes from a string using the current process engine's default charset- Parameters:
string
- the string to get the bytes form- Returns:
- the byte array
-
toByteArray
Gets the bytes from a string using the provided process engine's default charset- Parameters:
string
- the string to get the bytes formprocessEngine
- the process engine to use- Returns:
- the byte array
-
trimToMaximumLengthAllowed
Trims the input to themaxium length allowed
for persistence with our default database schema- Parameters:
string
- the input that might be trimmed if maximum length is exceeded- Returns:
- the input, eventually trimmed to
DB_MAX_STRING_LENGTH
-
joinDbEntityIds
-
joinProcessElementInstanceIds
public static String joinProcessElementInstanceIds(Collection<? extends ProcessElementInstance> processElementInstances) -
hasText
- Parameters:
string
- the String to check.- Returns:
- a boolean
TRUE
if the String is not null and not empty.FALSE
otherwise.
-
join
-