Interface PartitionAttributes
-
public interface PartitionAttributes
Provide a way to describe a partition using a collection of of attributes. Typically only a single type of any particularPartitionAttributes.Key
exists in eachPartitionAttributes
. For example:{ [Key(shard) = "shard X"], [Key(data center) = "data center X"], [Key(is main) = "false/true"] }
This construct allows for the attributes to partially specify a partition and preform "wild card" type matching.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
PartitionAttributes.Key<T>
A key identifies a specific object in aPartitionAttributes
.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <T> boolean
contains(PartitionAttributes.Key<T> key)
Determine if there is a value associated withkey
.void
forEach(java.util.function.BiConsumer<PartitionAttributes.Key,java.lang.Object> action)
Iterate over the key/value pairs in this collection.<T> T
get(PartitionAttributes.Key<T> key)
Get the value associated withkey
.boolean
isEmpty()
Determine if there are no key/value pairs in this collection.int
size()
Determine how many key/value pairs are contained in this collection.
-
-
-
Method Detail
-
get
@Nullable <T> T get(PartitionAttributes.Key<T> key)
Get the value associated withkey
.- Type Parameters:
T
- The expected value type associated withkey
.- Parameters:
key
- The key to lookup.- Returns:
- the value associated with
key
, ornull
.
-
contains
default <T> boolean contains(PartitionAttributes.Key<T> key)
Determine if there is a value associated withkey
.- Type Parameters:
T
- The expected value type associated withkey
.- Parameters:
key
- The key to check if there is any associated value for.- Returns:
true
if there is a value associated withkey
.
-
forEach
void forEach(java.util.function.BiConsumer<PartitionAttributes.Key,java.lang.Object> action)
Iterate over the key/value pairs in this collection.- Parameters:
action
- Invoked for each key/value pair in this collection.
-
size
int size()
Determine how many key/value pairs are contained in this collection.- Returns:
- the number of key/value pairs are contained in this collection.
-
isEmpty
boolean isEmpty()
Determine if there are no key/value pairs in this collection.- Returns:
true
if there are no key/value pairs in this collection.
-
-