@Immutable public abstract class Attributes extends Object implements ReadableAttributes
The keys are Strings and the values are AttributeValue instances.
| Modifier and Type | Class and Description |
|---|---|
static class |
Attributes.Builder
Enables the creation of an
Attributes instance with an arbitrary number of key-value
pairs. |
ReadableKeyValuePairs.KeyValueConsumer<V>| Constructor and Description |
|---|
Attributes() |
| Modifier and Type | Method and Description |
|---|---|
static Attributes |
empty()
Returns a
Attributes instance with no attributes. |
void |
forEach(ReadableKeyValuePairs.KeyValueConsumer<V> consumer)
Iterates over all the key-value pairs of attributes contained by this instance.
|
V |
get(String key)
Returns the value of the given key, or null if the key does not exist.
|
boolean |
isEmpty()
Whether there are any attributes contained in this.
|
static Attributes.Builder |
newBuilder()
Creates a new
Attributes.Builder instance for creating arbitrary Attributes. |
static Attributes |
of(String key,
AttributeValue value)
Returns a
Attributes instance with a single key-value pair. |
static Attributes |
of(String key1,
AttributeValue value1,
String key2,
AttributeValue value2)
Returns a
Attributes instance with two key-value pairs. |
static Attributes |
of(String key1,
AttributeValue value1,
String key2,
AttributeValue value2,
String key3,
AttributeValue value3)
Returns a
Attributes instance with three key-value pairs. |
static Attributes |
of(String key1,
AttributeValue value1,
String key2,
AttributeValue value2,
String key3,
AttributeValue value3,
String key4,
AttributeValue value4)
Returns a
Attributes instance with four key-value pairs. |
static Attributes |
of(String key1,
AttributeValue value1,
String key2,
AttributeValue value2,
String key3,
AttributeValue value3,
String key4,
AttributeValue value4,
String key5,
AttributeValue value5)
Returns a
Attributes instance with five key-value pairs. |
int |
size()
The number of attributes contained in this.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, get, isEmpty, sizepublic static Attributes empty()
Attributes instance with no attributes.public static Attributes of(String key, AttributeValue value)
Attributes instance with a single key-value pair.public static Attributes of(String key1, AttributeValue value1, String key2, AttributeValue value2)
Attributes instance with two key-value pairs. Order of the keys is not
preserved. Duplicate keys will be removed.public static Attributes of(String key1, AttributeValue value1, String key2, AttributeValue value2, String key3, AttributeValue value3)
Attributes instance with three key-value pairs. Order of the keys is not
preserved. Duplicate keys will be removed.public static Attributes of(String key1, AttributeValue value1, String key2, AttributeValue value2, String key3, AttributeValue value3, String key4, AttributeValue value4)
Attributes instance with four key-value pairs. Order of the keys is not
preserved. Duplicate keys will be removed.public static Attributes of(String key1, AttributeValue value1, String key2, AttributeValue value2, String key3, AttributeValue value3, String key4, AttributeValue value4, String key5, AttributeValue value5)
Attributes instance with five key-value pairs. Order of the keys is not
preserved. Duplicate keys will be removed.public static Attributes.Builder newBuilder()
Attributes.Builder instance for creating arbitrary Attributes.public int size()
ReadableKeyValuePairssize in interface ReadableKeyValuePairs<V>public boolean isEmpty()
ReadableKeyValuePairsisEmpty in interface ReadableKeyValuePairs<V>public void forEach(ReadableKeyValuePairs.KeyValueConsumer<V> consumer)
ReadableKeyValuePairsforEach in interface ReadableKeyValuePairs<V>@Nullable public V get(String key)
ReadableKeyValuePairsCurrently may be implemented via a linear search, depending on implementation, so O(n) performance in the worst case.
get in interface ReadableKeyValuePairs<V>