K
- the key typeP
- the partitionKey typepublic final class PartitionAwareKey<K,P> extends Object implements PartitionAware<Object>, DataSerializable
PartitionAware
key. This is useful in combination with a Map where you want to control the
partition of a key.Constructor and Description |
---|
PartitionAwareKey(K key,
P partitionKey)
Creates a new PartitionAwareKey.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object thatObject) |
K |
getKey()
Gets the key (not the partitionKey).
|
P |
getPartitionKey()
The key that will be used by Hazelcast to specify the partition.
|
int |
hashCode() |
void |
readData(ObjectDataInput in)
Reads fields from the input stream
|
String |
toString() |
void |
writeData(ObjectDataOutput out)
Writes object fields to output stream
|
public PartitionAwareKey(K key, P partitionKey)
key
- the keypartitionKey
- the partitionKeyIllegalArgumentException
- if key or partitionKey is null.public K getKey()
public P getPartitionKey()
PartitionAware
getPartitionKey
in interface PartitionAware<Object>
public void writeData(ObjectDataOutput out) throws IOException
DataSerializable
writeData
in interface DataSerializable
out
- outputIOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
output stream has been closed.public void readData(ObjectDataInput in) throws IOException
DataSerializable
readData
in interface DataSerializable
in
- inputIOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
input stream has been closed.Copyright © 2023 Hazelcast, Inc.. All rights reserved.