com.hazelcast.core
Class PartitionAwareKey<K,P>
java.lang.Object
com.hazelcast.core.PartitionAwareKey<K,P>
- Type Parameters:
K
- P
-
- All Implemented Interfaces:
- PartitionAware<Object>, DataSerializable
public final class PartitionAwareKey<K,P>
- extends Object
- implements PartitionAware<Object>, DataSerializable
A PartitionAware
key. This is useful in combination with a Map where you want to control the
partition of a key.
PartitionAwareKey
public PartitionAwareKey(K key,
P partitionKey)
- Creates a new PartitionAwareKey.
- Parameters:
key
- the keypartitionKey
- the partitionKey
- Throws:
IllegalArgumentException
- if key or partitionKey is null.
getKey
public K getKey()
getPartitionKey
public P getPartitionKey()
- Description copied from interface:
PartitionAware
- The key object that will be used by Hazelcast to specify the partition.
You should give the same key for objects that you want them to locate in the same partition.
- Specified by:
getPartitionKey
in interface PartitionAware<Object>
- Returns:
- partition key
writeData
public void writeData(com.hazelcast.nio.ObjectDataOutput out)
throws IOException
- Specified by:
writeData
in interface DataSerializable
- Throws:
IOException
readData
public void readData(com.hazelcast.nio.ObjectDataInput in)
throws IOException
- Specified by:
readData
in interface DataSerializable
- Throws:
IOException
equals
public boolean equals(Object thatObject)
- Overrides:
equals
in class Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2014 Hazelcast, Inc.. All Rights Reserved.