Interface StringValueCodec
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
DefaultStringValueCodec
Codec responsible for encoding string literals in a SPEL expression with a easily replaceable
label. The codec is also capable of decoding any encoded response it manufactures. The codec
keeps track of the original decoded values. As such, this object is not thread safe and a new
instance should be created for every usage. When decoding, it is not necessary to pass back the
entire encoded string. Rather, it is acceptable to pass back in portions of the encoded string
until the entire encoded string is accounted for.
This codec is generally used during rule validation and facilitates the breaking up of a compound (and/or) SPEL expression into individual expressions to be further evaluated. By encoding string literals, we don't have to worry about unexpected compound phrase matching inside of those literals during the phase where the compound expression is split into individual expressions.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
close()
Complete any resource allocated during codec usage.decodeValues
(String encoded) Replace all group labels with the original string literal value.encodeValues
(String decoded) Replace all string literal values in the decoded SPEL expression with a group label.
-
Method Details
-
encodeValues
Replace all string literal values in the decoded SPEL expression with a group label.- Parameters:
decoded
- The original expression- Returns:
- The expression with string literals replaced with a group label
-
decodeValues
Replace all group labels with the original string literal value.- Parameters:
encoded
- The encoded SPEL expression previously returned by this instance of StringValueCodec.- Returns:
- The expression with group labels replaced by the original string literals
-
close
default void close()Complete any resource allocated during codec usage. This is generally a good spot to assert that all original decoded values were accounted for during decoding.- Specified by:
close
in interfaceAutoCloseable
-