Package org.camunda.bpm.engine.variable
Class Variables
- java.lang.Object
-
- org.camunda.bpm.engine.variable.Variables
-
- Direct Known Subclasses:
ClientValues
public class Variables extends Object
This class is the entry point to the process engine's typed variables API. Users can import the methods provided by this class using a static import:
import static org.camunda.bpm.engine.variable.Variables.*;
- Author:
- Daniel Meyer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Variables.SerializationDataFormats
A set of builtin serialization dataformat constants.
-
Constructor Summary
Constructors Constructor Description Variables()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BooleanValue
booleanValue(Boolean booleanValue)
Creates a newBooleanValue
that encapsulates the givenbooleanValue
static BooleanValue
booleanValue(Boolean booleanValue, boolean isTransient)
Creates a newBooleanValue
that encapsulates the givenbooleanValue
static BytesValue
byteArrayValue(byte[] bytes)
Creates a newBytesValue
that encapsulates the givenbytes
static BytesValue
byteArrayValue(byte[] bytes, boolean isTransient)
Creates a newBytesValue
that encapsulates the givenbytes
static VariableMap
createVariables()
Returns a newVariableMap
instance.static DateValue
dateValue(Date date)
Creates a newDateValue
that encapsulates the givendate
static DateValue
dateValue(Date date, boolean isTransient)
Creates a newDateValue
that encapsulates the givendate
static DoubleValue
doubleValue(Double doubleValue)
Creates a newDoubleValue
that encapsulates the givendoubleValue
static DoubleValue
doubleValue(Double doubleValue, boolean isTransient)
Creates a newDoubleValue
that encapsulates the givendoubleValue
static VariableContext
emptyVariableContext()
static FileValue
fileValue(File file)
Shortcut for callingVariables.fileValue(name).file(file).mimeType(type).create()
.static FileValue
fileValue(File file, boolean isTransient)
Shortcut for callingVariables.fileValue(name).file(file).mimeType(type).setTransient(isTransient).create()
.static FileValueBuilder
fileValue(String filename)
Returns a builder to create a newFileValue
with the givenfilename
.static FileValueBuilder
fileValue(String filename, boolean isTransient)
Returns a builder to create a newFileValue
with the givenfilename
.static VariableMap
fromMap(Map<String,Object> map)
If the given map is not a variable map, adds all its entries as untyped values to a newVariableMap
.static IntegerValue
integerValue(Integer integer)
Creates a newIntegerValue
that encapsulates the giveninteger
static IntegerValue
integerValue(Integer integer, boolean isTransient)
Creates a newIntegerValue
that encapsulates the giveninteger
static LongValue
longValue(Long longValue)
Creates a newLongValue
that encapsulates the givenlongValue
static LongValue
longValue(Long longValue, boolean isTransient)
Creates a newLongValue
that encapsulates the givenlongValue
static NumberValue
numberValue(Number numberValue)
Creates an abstract Number value.static NumberValue
numberValue(Number numberValue, boolean isTransient)
Creates an abstract Number value.static ObjectValueBuilder
objectValue(Object value)
Returns a builder to create a newObjectValue
that encapsulates the givenvalue
.static ObjectValueBuilder
objectValue(Object value, boolean isTransient)
Returns a builder to create a newObjectValue
that encapsulates the givenvalue
.static VariableMap
putValue(String name, Object value)
Shortcut forVariables.createVariables().putValue(name, value)
static VariableMap
putValueTyped(String name, TypedValue value)
Shortcut forVariables.createVariables().putValueTyped(name, value)
static SerializedObjectValueBuilder
serializedObjectValue()
Returns a builder to create a newObjectValue
from a serialized object representation.static SerializedObjectValueBuilder
serializedObjectValue(String value)
Shortcut forVariables.serializedObjectValue().serializedValue(value)
static SerializedObjectValueBuilder
serializedObjectValue(String value, boolean isTransient)
Shortcut forVariables.serializedObjectValue().serializedValue(value).setTransient(isTransient)
static ShortValue
shortValue(Short shortValue)
Creates a newShortValue
that encapsulates the givenshortValue
static ShortValue
shortValue(Short shortValue, boolean isTransient)
Creates a newShortValue
that encapsulates the givenshortValue
static StringValue
stringValue(String stringValue)
Creates a newStringValue
that encapsulates the givenstringValue
static StringValue
stringValue(String stringValue, boolean isTransient)
Creates a newStringValue
that encapsulates the givenstringValue
static TypedValue
untypedNullValue()
static TypedValue
untypedNullValue(boolean isTransient)
static TypedValue
untypedValue(Object value)
Creates an untyped value, i.e.static TypedValue
untypedValue(Object value, boolean isTransient)
Creates an untyped value, i.e.
-
-
-
Method Detail
-
createVariables
public static VariableMap createVariables()
Returns a newVariableMap
instance.
-
fromMap
public static VariableMap fromMap(Map<String,Object> map)
If the given map is not a variable map, adds all its entries as untyped values to a newVariableMap
. If the given map is aVariableMap
, it is returned as is.
-
putValue
public static VariableMap putValue(String name, Object value)
Shortcut forVariables.createVariables().putValue(name, value)
-
putValueTyped
public static VariableMap putValueTyped(String name, TypedValue value)
Shortcut forVariables.createVariables().putValueTyped(name, value)
-
objectValue
public static ObjectValueBuilder objectValue(Object value)
Returns a builder to create a newObjectValue
that encapsulates the givenvalue
.
-
objectValue
public static ObjectValueBuilder objectValue(Object value, boolean isTransient)
Returns a builder to create a newObjectValue
that encapsulates the givenvalue
.
-
serializedObjectValue
public static SerializedObjectValueBuilder serializedObjectValue()
Returns a builder to create a newObjectValue
from a serialized object representation.
-
serializedObjectValue
public static SerializedObjectValueBuilder serializedObjectValue(String value)
Shortcut forVariables.serializedObjectValue().serializedValue(value)
-
serializedObjectValue
public static SerializedObjectValueBuilder serializedObjectValue(String value, boolean isTransient)
Shortcut forVariables.serializedObjectValue().serializedValue(value).setTransient(isTransient)
-
integerValue
public static IntegerValue integerValue(Integer integer)
Creates a newIntegerValue
that encapsulates the giveninteger
-
integerValue
public static IntegerValue integerValue(Integer integer, boolean isTransient)
Creates a newIntegerValue
that encapsulates the giveninteger
-
stringValue
public static StringValue stringValue(String stringValue)
Creates a newStringValue
that encapsulates the givenstringValue
-
stringValue
public static StringValue stringValue(String stringValue, boolean isTransient)
Creates a newStringValue
that encapsulates the givenstringValue
-
booleanValue
public static BooleanValue booleanValue(Boolean booleanValue)
Creates a newBooleanValue
that encapsulates the givenbooleanValue
-
booleanValue
public static BooleanValue booleanValue(Boolean booleanValue, boolean isTransient)
Creates a newBooleanValue
that encapsulates the givenbooleanValue
-
byteArrayValue
public static BytesValue byteArrayValue(byte[] bytes)
Creates a newBytesValue
that encapsulates the givenbytes
-
byteArrayValue
public static BytesValue byteArrayValue(byte[] bytes, boolean isTransient)
Creates a newBytesValue
that encapsulates the givenbytes
-
dateValue
public static DateValue dateValue(Date date)
Creates a newDateValue
that encapsulates the givendate
-
dateValue
public static DateValue dateValue(Date date, boolean isTransient)
Creates a newDateValue
that encapsulates the givendate
-
longValue
public static LongValue longValue(Long longValue)
Creates a newLongValue
that encapsulates the givenlongValue
-
longValue
public static LongValue longValue(Long longValue, boolean isTransient)
Creates a newLongValue
that encapsulates the givenlongValue
-
shortValue
public static ShortValue shortValue(Short shortValue)
Creates a newShortValue
that encapsulates the givenshortValue
-
shortValue
public static ShortValue shortValue(Short shortValue, boolean isTransient)
Creates a newShortValue
that encapsulates the givenshortValue
-
doubleValue
public static DoubleValue doubleValue(Double doubleValue)
Creates a newDoubleValue
that encapsulates the givendoubleValue
-
doubleValue
public static DoubleValue doubleValue(Double doubleValue, boolean isTransient)
Creates a newDoubleValue
that encapsulates the givendoubleValue
-
numberValue
public static NumberValue numberValue(Number numberValue)
Creates an abstract Number value. Note that this value cannot be used to set variables. Use the specific methodsintegerValue(Integer)
,shortValue(Short)
,longValue(Long)
anddoubleValue(Double)
instead.
-
numberValue
public static NumberValue numberValue(Number numberValue, boolean isTransient)
Creates an abstract Number value. Note that this value cannot be used to set variables. Use the specific methodsintegerValue(Integer)
,shortValue(Short)
,longValue(Long)
anddoubleValue(Double)
instead.
-
untypedNullValue
public static TypedValue untypedNullValue()
-
untypedNullValue
public static TypedValue untypedNullValue(boolean isTransient)
-
untypedValue
public static TypedValue untypedValue(Object value)
Creates an untyped value, i.e.TypedValue.getType()
returnsnull
for the returned instance.
-
untypedValue
public static TypedValue untypedValue(Object value, boolean isTransient)
Creates an untyped value, i.e.TypedValue.getType()
returnsnull
for the returned instance.
-
fileValue
public static FileValueBuilder fileValue(String filename)
Returns a builder to create a newFileValue
with the givenfilename
.
-
fileValue
public static FileValueBuilder fileValue(String filename, boolean isTransient)
Returns a builder to create a newFileValue
with the givenfilename
.
-
fileValue
public static FileValue fileValue(File file)
Shortcut for callingVariables.fileValue(name).file(file).mimeType(type).create()
. The name is set to the file name and the mime type is detected viaMimetypesFileTypeMap
.
-
fileValue
public static FileValue fileValue(File file, boolean isTransient)
Shortcut for callingVariables.fileValue(name).file(file).mimeType(type).setTransient(isTransient).create()
. The name is set to the file name and the mime type is detected viaMimetypesFileTypeMap
.
-
emptyVariableContext
public static VariableContext emptyVariableContext()
- Returns:
- an empty
VariableContext
(from which no variables can be resolved).
-
-