T
- the Java type of serialized / deserialized instances.public interface Type<T>
Message
s and ValueSpec
s:
TypeName
to identify the type.
TypeSerializer
for serializing and deserializing instances of the type.
StateFun's type system has cross-language support for common primitive types, such as boolean,
integer, long, etc. These primitive types have built-in Type
s implemented for them
already, with predefined TypeName
s.
This is of course all transparent for the user, so you don't need to worry about it. Functions implemented in various languages (e.g. Java or Python) can message each other by directly sending supported primitive values as message arguments. Moreover, the type system is used for state values as well; so, you can expect that a function can safely read previous state after reimplementing it in a different language.
The type system is also very easily extensible to support custom message types, such as JSON
or Protobuf messages. This is just a matter of implementing your own Type
with a custom
typename and serializer. Alternatively, you can also use the SimpleType
class to do this
easily.
Modifier and Type | Method and Description |
---|---|
default java.util.Set<TypeCharacteristics> |
typeCharacteristics() |
TypeName |
typeName() |
TypeSerializer<T> |
typeSerializer() |
TypeSerializer<T> typeSerializer()
TypeSerializer
that can serialize and deserialize this type.default java.util.Set<TypeCharacteristics> typeCharacteristics()
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.