@Immutable public class Constraints extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Constraints.KeyPredicate
A
Predicate for testing a StorageKey against a set of
predicates. |
| Constructor and Description |
|---|
Constraints(Schema schema) |
Constraints(Schema schema,
PartitionStrategy strategy) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
alignedWithBoundaries()
If this returns true, the entities selected by this set of constraints
align to partition boundaries.
|
boolean |
equals(Object o) |
<E> Iterator<E> |
filter(Iterator<E> iterator,
EntityAccessor<E> accessor)
Filter the entities returned by a given iterator by these constraints.
|
Constraints |
from(String name,
Comparable value) |
Constraints |
fromAfter(String name,
Comparable value) |
static Constraints |
fromQueryMap(Schema schema,
PartitionStrategy strategy,
Map<String,String> query) |
Map<String,Object> |
getProvidedValues()
Returns a map of provided or fixed values for this constraint set.
|
int |
hashCode() |
boolean |
isUnbounded()
Returns true if there are no constraints.
|
Constraints |
to(String name,
Comparable value) |
Constraints |
toBefore(String name,
Comparable value) |
<E> com.google.common.base.Predicate<E> |
toEntityPredicate(EntityAccessor<E> accessor)
Get a
Predicate for testing entity objects. |
<E> com.google.common.base.Predicate<E> |
toEntityPredicate(StorageKey key,
EntityAccessor<E> accessor)
Get a
Predicate for testing entity objects that match the given
StorageKey. |
Constraints.KeyPredicate |
toKeyPredicate()
Get a
Predicate that tests StorageKey objects. |
Iterable<MarkerRange> |
toKeyRanges()
Get a set of
MarkerRange objects that covers the set of possible
StorageKey partitions for this constraint set. |
Map<String,String> |
toNormalizedQueryMap()
Get a normalized query map for the constraints.
|
Map<String,String> |
toQueryMap() |
String |
toString() |
Constraints |
with(String name,
Object... values) |
public Constraints(Schema schema)
public Constraints(Schema schema, PartitionStrategy strategy)
public <E> com.google.common.base.Predicate<E> toEntityPredicate(EntityAccessor<E> accessor)
Predicate for testing entity objects.E - The type of entities to be matchedpublic <E> com.google.common.base.Predicate<E> toEntityPredicate(StorageKey key, EntityAccessor<E> accessor)
Predicate for testing entity objects that match the given
StorageKey.E - The type of entities to be matchedkey - a StorageKey for entities tested with the Predicatepublic <E> Iterator<E> filter(Iterator<E> iterator, EntityAccessor<E> accessor)
E - The type of entities to be matchedpublic Constraints.KeyPredicate toKeyPredicate()
Predicate that tests StorageKey objects.
If a StorageKey matches the predicate, it may represent a
partition that is responsible for entities that match this set of
constraints. If it does not match the predicate, it cannot be responsible
for entities that match this constraint set.NullPointerException - if no partition strategy is definedpublic Iterable<MarkerRange> toKeyRanges()
MarkerRange objects that covers the set of possible
StorageKey partitions for this constraint set. If a
StorageKey is not in one of the ranges returned by this method,
then its partition cannot contain entities that satisfy this constraint
set.NullPointerException - if no partition strategy is definedpublic boolean alignedWithBoundaries()
Predicate
from toKeyPredicate() is equivalent to this set of constraints
under the given PartitionStrategy. The key predicate must accept a
key if that key's partition might include entities matched by this
constraint set. If this method returns true, then all entities in the
partitions it matches are guaranteed to match this constraint set. So, the
partitions are equivalent to the constraints.NullPointerException - if no partition strategy is definedpublic Map<String,Object> getProvidedValues()
public Constraints with(String name, Object... values)
public Constraints from(String name, Comparable value)
public Constraints fromAfter(String name, Comparable value)
public Constraints to(String name, Comparable value)
public Constraints toBefore(String name, Comparable value)
public Map<String,String> toNormalizedQueryMap()
public static Constraints fromQueryMap(Schema schema, PartitionStrategy strategy, Map<String,String> query)
public boolean isUnbounded()
true if there are no constraints, false otherwiseCopyright © 2013–2015. All rights reserved.