public class LexicoHashKeyFieldCodec extends DefaultKeyFieldCodec implements KeyFieldCodec
KeyFieldCodec which emits hash value string bytes for
the DataType specific byte representation for the given value.
This codec saves on space by terminating with the minimum added bytes possible for the hashed bytes for the native
DataType.Type,
DataFlavor,
HashAlgorithmName| Modifier and Type | Field and Description |
|---|---|
protected HashAlgorithmName |
hashName |
static int |
MAX_LENGTH
the max integer digits 2B (10 digits) plus the negitive sign
|
keyField| Constructor and Description |
|---|
LexicoHashKeyFieldCodec(KeyFieldMapping keyField,
HashAlgorithmName hash) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkEncodeOverflow(byte[] keyValue)
Returns true if the given encoded value will overflow the underlying key
field.
|
Object |
decode(byte[] value)
Returns the object representation for the given encoded bytes value.
|
byte[] |
encode(Object value)
Returns the encoded bytes representation for the given object or literal
value.
|
byte[] |
encodeNext(Object value)
Returns the encoded "next" bytes representation for the given object or
literal value, where the next value depends on the coded implementation and
may typically be the lexicographic next value.
|
boolean |
isLexicographic()
Return true if the encoded values support lexicographic ordering.
|
boolean |
isTransforming()
Return true if the encoded values are fundamentally transformed father than
formatted or padded in some way.
|
protected HashAlgorithmName hashName
public static final int MAX_LENGTH
public LexicoHashKeyFieldCodec(KeyFieldMapping keyField, HashAlgorithmName hash)
public boolean isLexicographic()
KeyFieldCodecisLexicographic in interface KeyFieldCodecpublic boolean isTransforming()
KeyFieldCodecisTransforming in interface KeyFieldCodecpublic byte[] encode(Object value)
KeyFieldCodecencode in interface KeyFieldCodecvalue - the object or literal valuepublic boolean checkEncodeOverflow(byte[] keyValue)
KeyFieldCodeccheckEncodeOverflow in interface KeyFieldCodecpublic Object decode(byte[] value)
KeyFieldCodecdecode in interface KeyFieldCodecvalue - encoded bytes valuepublic byte[] encodeNext(Object value)
KeyFieldCodecencodeNext in interface KeyFieldCodecvalue - the object or literal valueCopyright © 2024. All Rights Reserved.