@Retention(value=RUNTIME)
@Target(value=FIELD)
public @interface HollowHashKey
Set
or Map
has a hash key defining how the
hollow objects that are elements in a Set
or are keys in a
Map
are hashed.
A hash is derived from the sequence of values obtained by resolving
the field
paths (in order) given an hollow object that is
the element or key.
Such hashes are used to distribute the hollow objects encoded within a
hollow set or map.
By default if this annotation is not declared on a field of type Set
or Map
,
referred to as the hash key field, then a hash key is derived from the element or key type
as follows.
If the type is annotated with HollowPrimaryKey
then it's as if the
hash key field is annotated with HollowHashKey
with the same field paths as
declared by the HollowPrimaryKey
.
Otherwise, if the type declares exactly one field whose type is a primitive type then
it's as if the hash key field is annotated with HollowHashKey
with a single
field path that is the name of that one field.
Otherwise, it's as if the field is annotated with HollowHashKey
with an empty
field paths array (indicating the ordinal of an element or key is used as the hash).
This annotation with an empty array may be utilized to enforce the latter case,
overriding one of the other prior cases, if applicable.
Modifier and Type | Required Element and Description |
---|---|
java.lang.String[] |
fields
Returns the field paths of the hash key.
|