K
- type of the key.@NotThreadSafe @Internal public final class SerializedCompositeKeyBuilder<K> extends Object
Constructor and Description |
---|
SerializedCompositeKeyBuilder(TypeSerializer<K> keySerializer,
int keyGroupPrefixBytes,
int initialSize) |
Modifier and Type | Method and Description |
---|---|
byte[] |
build()
Returns a serialized composite key, from whatever was set so far.
|
<N> byte[] |
buildCompositeKeyNamespace(N namespace,
TypeSerializer<N> namespaceSerializer)
Returns a serialized composite key, from the key and key-group provided in a previous call to
setKeyAndKeyGroup(Object, int) and the given namespace. |
<N,UK> byte[] |
buildCompositeKeyNamesSpaceUserKey(N namespace,
TypeSerializer<N> namespaceSerializer,
UK userKey,
TypeSerializer<UK> userKeySerializer)
Returns a serialized composite key, from the key and key-group provided in a previous call to
setKeyAndKeyGroup(Object, int) and the given namespace, followed by the given
user-key. |
<UK> byte[] |
buildCompositeKeyUserKey(UK userKey,
TypeSerializer<UK> userKeySerializer)
Returns a serialized composite key, from the key and key-group provided in a previous call to
setKeyAndKeyGroup(Object, int) and the namespace provided in setNamespace(Object, TypeSerializer) , followed by the given user-key. |
void |
setKeyAndKeyGroup(K key,
int keyGroupId)
Sets the key and key-group as prefix.
|
<N> void |
setNamespace(N namespace,
TypeSerializer<N> namespaceSerializer) |
public SerializedCompositeKeyBuilder(@Nonnull TypeSerializer<K> keySerializer, @Nonnegative int keyGroupPrefixBytes, @Nonnegative int initialSize)
public void setKeyAndKeyGroup(@Nonnull K key, @Nonnegative int keyGroupId)
key
- the key.keyGroupId
- the key-group id for the key.public <N> void setNamespace(@Nonnull N namespace, @Nonnull TypeSerializer<N> namespaceSerializer)
@Nonnull public <N> byte[] buildCompositeKeyNamespace(@Nonnull N namespace, @Nonnull TypeSerializer<N> namespaceSerializer)
setKeyAndKeyGroup(Object, int)
and the given namespace.N
- the type of the namespace.namespace
- the namespace to concatenate for the serialized composite key bytes.namespaceSerializer
- the serializer to obtain the serialized form of the namespace.@Nonnull public <N,UK> byte[] buildCompositeKeyNamesSpaceUserKey(@Nonnull N namespace, @Nonnull TypeSerializer<N> namespaceSerializer, @Nonnull UK userKey, @Nonnull TypeSerializer<UK> userKeySerializer) throws IOException
setKeyAndKeyGroup(Object, int)
and the given namespace, followed by the given
user-key.N
- the type of the namespace.UK
- the type of the user-key.namespace
- the namespace to concatenate for the serialized composite key bytes.namespaceSerializer
- the serializer to obtain the serialized form of the namespace.userKey
- the user-key to concatenate for the serialized composite key, after the
namespace.userKeySerializer
- the serializer to obtain the serialized form of the user-key.IOException
@Nonnull public <UK> byte[] buildCompositeKeyUserKey(@Nonnull UK userKey, @Nonnull TypeSerializer<UK> userKeySerializer) throws IOException
setKeyAndKeyGroup(Object, int)
and the namespace provided in setNamespace(Object, TypeSerializer)
, followed by the given user-key.UK
- the type of the user-key.userKey
- the user-key to concatenate for the serialized composite key, after the
namespace.userKeySerializer
- the serializer to obtain the serialized form of the user-key.IOException
@Nonnull public byte[] build() throws IOException
IOException
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.