Skip to content
Development preview · 2.0.0-SNAPSHOT

Process Data Types and Conversion

Process definitions declare Java types for variables and action parameters. CompileFlow validates those declarations during runtime preparation and supports the conversions listed below. Integral conversions must be exact; floating-point conversions may round. Conversion rejects invalid values instead of substituting a default, and text parsing is locale-independent.

A declaration is a case-sensitive Java type name with optional generic arguments and array suffixes:

java.lang.String
int[]
java.util.List<java.lang.String>
java.util.List<int[]>
java.util.Map.Entry<java.lang.String, java.lang.Integer>
java.util.Map<java.lang.String, java.util.List<java.lang.Integer[]>>[][]

When using these declarations in a TBBPM dataType attribute, escape the generic angle brackets as required by XML. For example, declare an integer-list input as:

<var name="items" dataType="java.util.List&lt;java.lang.Integer&gt;" inOutType="param"/>

See the TBBPM specification for variable and action-parameter syntax. The rules below describe the types themselves.

Use fully qualified type names except for the built-in aliases: String, Object, the eight Java primitive names, and the simple names of their java.lang wrappers. Generic argument types must be visible to the compilation ClassLoader, and the argument count must match the target class. Missing classes, incorrect case, malformed suffixes, or arrays deeper than the JVM limit fail preflight. Primitive types cannot be generic arguments directly, but arrays of primitives can. Member classes use canonical names such as java.util.Map.Entry; the engine converts these to JVM binary names when loading the class.

Java erases generic arguments at runtime. CompileFlow keeps them in declarations and generated source so that javac can check static type compatibility. For values from an input Map<String, ?>, a script, or a child-process result, ProcessEngine checks only the outer class, such as List or Map. It does not inspect or convert each element. For example, when supplying this kind of input for List<Integer>, the application must still ensure that its elements are Integer values.

Typed DTO input follows the same value rules. The default mapper binds top-level properties while retaining their Java values: a Customer member remains a Customer, and elements of a List<Customer> remain application objects. It does not convert them into nested JSON Maps. The application remains responsible for collection element types. See typed input and output for property-mapping rules.

Durable must also store Run state. Persisted values must satisfy the Kernel’s supported data shapes and encoding rules; a Java class being visible to a ClassLoader does not make its instances eligible for storage. Applications cannot extend these rules with a custom payload-codec SPI. Before persisting objects, check the round-trip requirements under Persisted state types.

Durable Map types must declare String keys, including Map members of beans and records. The codec does not convert JSON field names into numbers, enums, or application objects. For numeric or composite identifiers, model each entry as an object with typed fields for its identifier and value.

Java expressions in process definitions use the same name-resolution rules in compiled and interpreted execution. Types in java.lang, such as String and Math, are available by their simple names. Use fully qualified names for other types, for example java.util.Map.of("key", value). Declaring a variable or action parameter type does not import that type into expressions. Generated helper classes and methods are not part of the expression API. Script actions use the name-resolution rules of their selected script implementation.

An ordinary Action’s source is a Java expression for every Action kind, including script Actions. Its declared dataType supplies the target type. Preparation checks Java assignment rules, including generic arguments, boxing, unboxing, primitive widening, and target typing for lambdas and method references. It never evaluates the expression. The same rules apply in compiled and interpreted execution, and in Durable.

A variable name, surrounding whitespace, parentheses, and comments do not select different conversion rules. For example, a String variable cannot initialize an int input through source="value" or source="(value)"; write source="Integer.parseInt(value)". An Integer can initialize a long input through unboxing and widening, but an input declared as Long needs an expression such as source="value.longValue()". Implicit narrowing and incompatible generic arguments fail during preparation.

A ProcessCall’s source is also a Java expression. Its result crosses the called process’s typed parameter boundary, where the runtime conversion rules below apply. A call’s value is parsed using that parameter’s declared type. Call mappings therefore do not declare dataType. Reconcile inputs retain their separate contract: they name fields of the saved Effect request or defined Effect metadata, rather than process expressions.

Expressions compute values. They must not modify process state or external systems. Input, call, condition, loop, Wait and Timer expressions reject direct assignments, increments and decrements, including those expressed through Java Unicode escapes. Valid strings, character literals and Unicode escapes remain supported. This static check does not prove method purity; authors must not mutate reachable objects or external systems through method calls. Put external business operations in Actions, and use Effects when Durable must recover their outcomes. An expression can be evaluated again if an uncommitted Turn is retried. Effect input expressions are evaluated before the request is saved; later dispatch and recovery use the saved typed input instead of evaluating them again.

Durable control and scheduling expressions

Section titled “Durable control and scheduling expressions”

Durable validates gateway, loop and control conditions, as well as Timer and Wait deadline expressions, more narrowly than input mappings. In addition to Java type checking, it checks the expression structure and the resolved method declarations:

  • Visible variables, literals, parentheses, arithmetic, comparisons, logical and bitwise operators, and conditional expressions are allowed. Ordinary field access is forbidden; array length and enum constants qualified by their declaring type are allowed.
  • Calls are limited to selected JDK instance methods (for example, String.equals, BigDecimal.compareTo, List.isEmpty, and Instant.isBefore), and application methods shaped like zero-argument non-void JavaBean getters or record component accessors. Static calls, object construction, arbitrary method calls, and array indexing are outside the allowlist.
  • == and != require primitive operands, a null comparison, or operands of the same concrete enum type. For boxed values, use explicit unboxing or a supported value comparison method.

For example, if items is declared as List, use !items.isEmpty() as a condition. An Instant variable named approvalDeadline can directly supply an absolute deadline. Instant.now() and approvalDeadline.plusSeconds(30) are not allowed here; calculate the schedule in an appropriate Action and save it through a declared output.

The validator limits expression source to 8 KiB of UTF-8, visible variables to 128, AST nodes to 512, and AST depth to 64. Validation failures report DURABLE_EXPRESSION_UNSAFE. An allowed accessor is not proof of purity: applications must still ensure deterministic, read-only, replayable behavior. These restrictions do not replace the Java typing rules for Action or ProcessCall input mappings.

Process variables store primitive scalars as their wrapper types. For example, a variable declared as int stores an Integer and can be null. Action inputs, Action results, and inputs to an Effect reconciliation action keep their declared Java types: an int input selects accept(int) ahead of accept(Integer), while an Integer input selects the wrapper overload. Passing null to a primitive parameter fails before the method is called. Primitive results are boxed when written to nullable process variables.

For class and bean actions, case-sensitive target names identify the formal parameters. Declared input types then select the most specific applicable overload. Primitive widening, boxing and unboxing follow the Java method invocation rules. Bind a varargs parameter as a single named array input. For example, String... recipients takes dataType="java.lang.String[]". Compiled execution, interpreted execution, and Durable Action adapters all use the declared signature. They do not choose a different overload based on the runtime class of an object in the input map.

Runtime conversion applies at input Map, literal, Action output, and called-process parameter/result boundaries. Authored Action input expressions use the Java assignment rules above.

null remains null, and a value already assignable to the target type is returned unchanged. Other supported conversions are listed below. The finite-number rule applies when conversion is needed; an already assignable Float or Double is not revalidated. Validate non-finite values in the application if your process does not accept them.

Target Accepted source Rule
Integral numbers and BigInteger Number or decimal text Conversion must be exact and in range; fractional values, overflow, separators, and non-finite numbers fail
float / double Number or Java floating-point text Conversion may round; result must be finite
BigDecimal Number or decimal text Java locale-independent decimal syntax only
boolean Boolean or true / false text No numeric, yes/no, or on/off guessing
char Character or one UTF-16 code unit Longer and empty text fail
String Any non-null object Uses the object’s string representation
LocalDate, LocalTime, LocalDateTime, Instant Matching JDBC temporal value, java.util.Date for Instant, or ISO-8601 text Strict ISO parsing; invalid calendar values fail
JDBC Date, Time, Timestamp Matching java.time value, java.util.Date for Timestamp, or strict ISO text Time rejects fractional seconds it cannot preserve; Timestamp accepts local date-time or an absolute instant
java.util.Date Instant or ISO instant text A timezone/offset and millisecond precision are mandatory; local date-time text and lossy nanosecond precision are rejected

The Date-to-Instant and Date-to-Timestamp conversions do not accept JDBC Date or Time, because these types do not support toInstant().

Floating-point text uses Float.parseFloat / Double.parseDouble, including decimal and hexadecimal forms. Boolean text is case-insensitive. Numeric and boolean parsing removes surrounding whitespace; characters and strings preserve it. Text parsing is locale-independent. An absolute instant must include its offset; the engine does not infer one.

Conversions between local date/time values and JDBC Date, Time, or Timestamp follow JDK rules and depend on the JVM’s default time zone. Keep that zone stable when using these types. Date and Timestamp conversions also reject values that cannot round-trip unchanged. Prefer Instant when the value represents an absolute point in time. Conversion failures report the source and target types without exposing values that might contain credentials or personal data.

An explicit numeric or boolean input literal must contain a value (for example, value="0" or value="false"). Preparation rejects empty and whitespace-only literals, including for boxed types. Process-call input literals use the same rule against the resolved child parameter type.

Variable defaults are validated during runtime preparation, with the same literal rules for compiled and interpreted execution:

  • Primitive, wrapper, string, BigInteger, BigDecimal, java.time, and JDBC temporal literals use strict parsing.
  • Process variables declared with primitive aliases are normalized to wrappers. Their missing default is null, just as for other reference types.
  • A missing input-map key preserves the declared default. A present key overrides it; an explicit null therefore remains distinct from an absent input.
  • An empty String is a real empty-string default. A char or Character default must contain exactly one UTF-16 code unit; a single whitespace character is preserved, and empty text fails validation. Blank defaults for other types are treated as absent.
  • Every default is a data literal. @ has no special meaning, so a String default such as @name preserves those characters while the same text fails validation for an incompatible numeric or temporal type.
  • Unsupported object defaults fail preflight. Supply those values through the input context instead.

For example, suppose a param variable named count has a declared default of 5:

Input map Initial value for execution
No count key 5
count is present with a null value null
count is present with the value 7 7

Prefer java.time types for process definitions. Use java.util.Date and java.sql types at integration boundaries that require them.