K - type of the entry keyV - type of the entry valuepublic class PartitionPredicate<K,V> extends Object implements Predicate<K,V>, IdentifiedDataSerializable
Predicate that restricts the execution of a Predicate to a single Partition.
This can help to speed up query execution since only a single instead of all partitions needs to be queried.
This predicate can only be used as an outer predicate.| Constructor and Description |
|---|
PartitionPredicate() |
PartitionPredicate(Object partitionKey,
Predicate<K,V> target)
Creates a new PartitionPredicate.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
apply(Map.Entry<K,V> mapEntry)
Applies this predicate to the given map entry.
|
int |
getFactoryId()
Returns DataSerializableFactory factory ID for this class.
|
int |
getId()
Returns type identifier for this class.
|
Object |
getPartitionKey()
Returns the partition key that determines the partition the target
Predicate is going to execute on. |
Predicate<K,V> |
getTarget()
Returns the target
Predicate. |
void |
readData(ObjectDataInput in)
Reads fields from the input stream
|
String |
toString() |
void |
writeData(ObjectDataOutput out)
Writes object fields to output stream
|
public PartitionPredicate()
public PartitionPredicate(Object partitionKey, Predicate<K,V> target)
partitionKey - the partition keytarget - the target PredicateIllegalArgumentException - if partition ID smaller than zeroNullPointerException - if target Predicate is nullpublic Object getPartitionKey()
Predicate is going to execute on.public Predicate<K,V> getTarget()
Predicate.Predicate.public boolean apply(Map.Entry<K,V> mapEntry)
PredicateImplementations must be thread-safe, since this method may be called by multiple threads concurrently.
public int getFactoryId()
IdentifiedDataSerializablegetFactoryId in interface IdentifiedDataSerializablepublic int getId()
IdentifiedDataSerializablegetId in interface IdentifiedDataSerializablepublic void writeData(ObjectDataOutput out) throws IOException
DataSerializablewriteData in interface DataSerializableout - 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
DataSerializablereadData in interface DataSerializablein - inputIOException - if an I/O error occurs. In particular,
an IOException may be thrown if the
input stream has been closed.Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.