Interface ValueDecoder<Data>
-
- Type Parameters:
Data
- The codegen or primitive type that this decodes aValue
to.
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ValueDecoder<Data>
A converter from the encoded form of a Daml value, represented byValue
, to the codegen-decoded form, represented byData
.Every codegen class for a template, record, or variant includes a
valueDecoder
method that produces one of these. If the data type has type parameters,valueDecoder
has arguments that correspond toValueDecoder
s for those type arguments. For primitive types that are not code-generated, seePrimitiveValueDecoders
.// given template 'Foo', and encoded payload 'Value fooValue' Foo foo = Foo.valueDecoder().decode(fooValue); // given Daml datatypes 'Bar a b' and 'Baz', // and encoded 'Bar' 'Value barValue' Bar<Baz, Long> bar = Bar.valueDecoder( Baz.valueDecoder(), PrimitiveValueDecoders.fromInt64) .decode(barValue); Bar<List<Baz>, Map<Long, String>> barWithAggregates = Bar.valueDecoder( PrimitiveValueDecoders.fromList(Baz.valueDecoder), PrimitiveValueDecoders.fromGenMap( PrimitiveValueDecoders.fromInt64, PrimitiveValueDecoders.fromText)) .decode(barAggregateValue);
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description Data
decode(Value value)
static <A> ValueDecoder<A>
fromFunction(java.util.function.Function<Value,A> fromValue)
Deprecated.since Daml 2.5.0; it is only used in deprecated fromValue method of all generated data class
-
-
-
Method Detail
-
decode
Data decode(Value value)
- See Also:
ValueDecoder
-
fromFunction
@Deprecated static <A> ValueDecoder<A> fromFunction(java.util.function.Function<Value,A> fromValue)
Deprecated.since Daml 2.5.0; it is only used in deprecated fromValue method of all generated data class
-
-