Package dev.cel.common.internal
Class BidiConverter<A,B>
- java.lang.Object
-
- dev.cel.common.internal.BidiConverter<A,B>
-
- Type Parameters:
A- The proto value type.B- The CEL value type.
@CheckReturnValue @Internal public abstract class BidiConverter<A,B> extends java.lang.Object
TheBidiConverteris a bidirectional converter which containsConverterobjects to forward convert from proto to CEL and backward convert from CEL to proto.Use the
BidiConverterwhen dealing with reading and constructing proto messages during expression interpretation as CEL numeric primitives are wider than many of the proto primitives.CEL Library Internals. Do Not Use.
-
-
Field Summary
Fields Modifier and Type Field Description static BidiConverter<java.lang.Object,java.lang.Object>IDENTITYABidiConverterused for objects which do not need conversion.
-
Constructor Summary
Constructors Constructor Description BidiConverter()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Converter<B,A>backwardConverter()Return theConverterwhich adapts from CEL values to proto values.abstract Converter<A,B>forwardConverter()Return theConverterwhich adapts from proto values to CEL values.static <A> BidiConverter<A,A>identity()static <A,B>
BidiConverter<A,B>of(Converter<A,B> forwardConverter, Converter<B,A> backwardConverter)BidiConverter<B,A>reverse()Return aBidiConverterwith the converter references reversed.
-
-
-
Field Detail
-
IDENTITY
public static final BidiConverter<java.lang.Object,java.lang.Object> IDENTITY
ABidiConverterused for objects which do not need conversion.
-
-
Method Detail
-
forwardConverter
public abstract Converter<A,B> forwardConverter()
Return theConverterwhich adapts from proto values to CEL values.
-
backwardConverter
public abstract Converter<B,A> backwardConverter()
Return theConverterwhich adapts from CEL values to proto values.
-
reverse
public BidiConverter<B,A> reverse()
Return aBidiConverterwith the converter references reversed.
-
of
public static <A,B> BidiConverter<A,B> of(Converter<A,B> forwardConverter, Converter<B,A> backwardConverter)
-
identity
public static <A> BidiConverter<A,A> identity()
-
-