FunctionNodes

Creates FunctionNodes from Java with a type per port. Jackson reads each input into the input type and writes each output as JSON, so records and POJOs work as ports; Object.class leaves a port untyped, a Content or Event port passes values as they are, and a port typed this way infers no schema. To run a node on each item of a list, wrap it with FunctionNode.parallelOf.

Functions

Link copied to clipboard
fun <I, O> builder(inputType: TypeReference<I>, outputType: TypeReference<O>): FunctionNode.Builder<I, O>

Like builder with classes, for generic port types such as List<String>.

fun <I, O> builder(inputType: TypeReference<I>, outputType: Class<O & Any>): FunctionNode.Builder<I, O>

Like builder with classes, for a generic input type.

fun <I, O> builder(inputType: Class<I & Any>, outputType: TypeReference<O>): FunctionNode.Builder<I, O>

Like builder with classes, for a generic output type.

fun <I, O> builder(inputType: Class<I & Any>, outputType: Class<O & Any>): FunctionNode.Builder<I, O>

Returns a FunctionNode.Builder whose node reads inputs as inputType and writes outputType outputs as JSON, for setting properties that of does not take.

Link copied to clipboard
fun <I, O> of(name: String, inputType: TypeReference<I>, outputType: TypeReference<O>, body: NodeBody<I, O>): FunctionNode<I, O>

Like of with classes, for generic port types such as List<String>.

fun <I, O> of(name: String, inputType: TypeReference<I>, outputType: Class<O & Any>, body: NodeBody<I, O>): FunctionNode<I, O>

Like of with classes, for a generic input type.

fun <I, O> of(name: String, inputType: Class<I & Any>, outputType: TypeReference<O>, body: NodeBody<I, O>): FunctionNode<I, O>

Like of with classes, for a generic output type.

fun <I, O> of(name: String, inputType: Class<I & Any>, outputType: Class<O & Any>, body: NodeBody<I, O>): FunctionNode<I, O>

Returns a node named name that runs body on each input read as inputType and writes its outputType output as JSON.

Link copied to clipboard
fun <T> requestInput(interruptId: String = Uuid.random(), message: String? = null, payload: Any? = null, responseSchema: Schema? = null): T

Asks the user for input like NodeBody.requestInput, and sends payload as JSON through the same mapper as typed ports, so a record or POJO reaches the client in its JSON form.