@Immutable @ThreadSafe public final class ImmutableAttributeMap extends Object implements Serializable
AttributeDefinition
s to AttributeValue
s.Modifier and Type | Class and Description |
---|---|
static class |
ImmutableAttributeMap.Builder
Builder pattern for the
ImmutableAttributeMap class. |
static class |
ImmutableAttributeMap.ImmutableAttributeEntry<T>
A typesafe and immutable map entry (key-value pair).
|
Modifier and Type | Method and Description |
---|---|
static ImmutableAttributeMap.Builder |
builder() |
static ImmutableAttributeMap.Builder |
builder(ImmutableAttributeMap.Builder copy) |
static ImmutableAttributeMap.Builder |
builder(ImmutableAttributeMap copy) |
static ImmutableAttributeMap.Builder |
builder(Map<AttributeDefinition<?>,? extends Iterable<? extends AttributeValue<?>>> copy) |
static ImmutableAttributeMap |
copyOf(Map<AttributeDefinition<?>,? extends Iterable<? extends AttributeValue<?>>> map) |
com.google.common.collect.ImmutableSet<ImmutableAttributeMap.ImmutableAttributeEntry<?>> |
entrySet() |
boolean |
equals(Object o) |
com.google.common.collect.ImmutableMap<AttributeDefinition<?>,com.google.common.collect.ImmutableSet<? extends AttributeValue<?>>> |
getAttributeMap()
Returns the content of this object as an
ImmutableMap where keys are AttributeDefinition s and
values are ImmutableSet s of AttributeValue s. |
<T> com.google.common.collect.ImmutableSet<? extends AttributeValue<T>> |
getAttributeValues(AttributeDefinition<T> attributeDefinition)
Returns the
AttributeValue s for the given AttributeDefinition as an ImmutableSet or
returns null if no attribute in this map matches the given AttributeDefinition . |
ImmutableAttributeMap |
getAttributeValuesByFriendlyName(String friendlyName)
Returns the sub-map of this map where all the keys have the given friendly name or returns
null if no
attribute in this map has that friendly name. |
<T> com.google.common.collect.ImmutableSet<? extends AttributeValue<T>> |
getAttributeValuesByNameUri(String name) |
<T> com.google.common.collect.ImmutableSet<? extends AttributeValue<T>> |
getAttributeValuesByNameUri(URI name) |
<T> AttributeDefinition<T> |
getDefinitionByNameUri(String name)
Returns all the
AttributeDefinition s in the map matching the given attribute name URI (i.e. |
<T> AttributeDefinition<T> |
getDefinitionByNameUri(URI name)
Returns all the
AttributeDefinition s in the map matching the given attribute name URI (i.e. |
com.google.common.collect.ImmutableSet<AttributeDefinition<?>> |
getDefinitions()
Returns all the
AttributeDefinition s in the map, can be empty but never null . |
com.google.common.collect.ImmutableSet<AttributeDefinition<?>> |
getDefinitionsByFriendlyName(String friendlyName)
Returns all the
AttributeDefinition s in the map matching the given friendly name or returns null
if no attribute in this map matches the given AttributeDefinition . |
<T> AttributeValue<T> |
getFirstAttributeValue(AttributeDefinition<T> attributeDefinition)
Returns the first
AttributeValue for the given AttributeDefinition or returns null if no
attribute in this map matches the given AttributeDefinition . |
<T> T |
getFirstValue(AttributeDefinition<T> attributeDefinition)
Returns the first typed value for the given
AttributeDefinition or returns null if no attribute
in this map matches the given AttributeDefinition . |
ImmutableValueMap |
getValueMap()
Returns the content of this object as an
ImmutableValueMap where keys are AttributeDefinition s
and values are ImmutableSet s of typed values. |
<T> com.google.common.collect.ImmutableSet<? extends T> |
getValues(AttributeDefinition<T> attributeDefinition)
Returns the typed values for the given
AttributeDefinition as an ImmutableSet or returns null if no attribute in this map matches the given AttributeDefinition . |
ImmutableValueMap |
getValuesByFriendlyName(String friendlyName)
Returns the sub-map of this map where all the keys have the given friendly name or returns
null if no
attribute in this map has that friendly name. |
<T> com.google.common.collect.ImmutableSet<? extends T> |
getValuesByNameUri(String name) |
<T> com.google.common.collect.ImmutableSet<? extends T> |
getValuesByNameUri(URI name) |
int |
hashCode() |
boolean |
isEmpty() |
static ImmutableAttributeMap |
of() |
static <T> ImmutableAttributeMap |
of(AttributeDefinition<T> attributeDefinition,
AttributeValue<T>... values) |
static <T> ImmutableAttributeMap |
of(AttributeDefinition<T> attributeDefinition,
Iterable<? extends AttributeValue<T>> values) |
int |
size() |
String |
toString() |
static ImmutableValueMap |
toValueMap(Map<AttributeDefinition<?>,com.google.common.collect.ImmutableSet<? extends AttributeValue<?>>> map) |
static <T> com.google.common.collect.ImmutableSet<? extends T> |
toValues(Iterable<? extends AttributeValue<T>> attributeValues) |
@Nonnull public static ImmutableAttributeMap.Builder builder()
@Nonnull public static ImmutableAttributeMap.Builder builder(@Nonnull ImmutableAttributeMap.Builder copy)
@Nonnull public static ImmutableAttributeMap.Builder builder(@Nonnull ImmutableAttributeMap copy)
@Nonnull public static ImmutableAttributeMap.Builder builder(@Nonnull Map<AttributeDefinition<?>,? extends Iterable<? extends AttributeValue<?>>> copy)
@Nonnull public static ImmutableAttributeMap copyOf(@Nonnull Map<AttributeDefinition<?>,? extends Iterable<? extends AttributeValue<?>>> map)
@Nonnull public static ImmutableAttributeMap of()
@Nonnull public static <T> ImmutableAttributeMap of(@Nonnull AttributeDefinition<T> attributeDefinition, @Nonnull Iterable<? extends AttributeValue<T>> values)
@Nonnull public static <T> ImmutableAttributeMap of(@Nonnull AttributeDefinition<T> attributeDefinition, @Nonnull AttributeValue<T>... values)
@Nullable public static ImmutableValueMap toValueMap(@Nullable Map<AttributeDefinition<?>,com.google.common.collect.ImmutableSet<? extends AttributeValue<?>>> map)
@Nullable public static <T> com.google.common.collect.ImmutableSet<? extends T> toValues(@Nullable Iterable<? extends AttributeValue<T>> attributeValues)
@Nonnull public com.google.common.collect.ImmutableSet<ImmutableAttributeMap.ImmutableAttributeEntry<?>> entrySet()
@Nonnull public com.google.common.collect.ImmutableMap<AttributeDefinition<?>,com.google.common.collect.ImmutableSet<? extends AttributeValue<?>>> getAttributeMap()
ImmutableMap
where keys are AttributeDefinition
s and
values are ImmutableSet
s of AttributeValue
s.ImmutableMap
.@Nullable public <T> com.google.common.collect.ImmutableSet<? extends AttributeValue<T>> getAttributeValues(@Nonnull AttributeDefinition<T> attributeDefinition)
AttributeValue
s for the given AttributeDefinition
as an ImmutableSet
or
returns null
if no attribute in this map matches the given AttributeDefinition
.T
- the type of the AttributeValue
.attributeDefinition
- the attribute definition to look up.AttributeValue
s (if any) corresponding to the given AttributeDefinition
.@Nullable public ImmutableAttributeMap getAttributeValuesByFriendlyName(@Nonnull String friendlyName)
null
if no
attribute in this map has that friendly name.
The returned map has AttributeDefinition
s as Map keys and ImmutableSet
of AttributeValue
s
as Map values.
If you want to have a sub-map of values instead of AttributeValue
s, use getValuesByFriendlyName(String)
instead.
friendlyName
- the friendly name which returned attribute keys must possessAttributeDefinition
s which have the given friendly
name and where the values are ImmutableSet
s of AttributeValue
s or returns null
if no
attribute in this map has that friendly name.@Nullable public <T> com.google.common.collect.ImmutableSet<? extends AttributeValue<T>> getAttributeValuesByNameUri(@Nonnull String name)
@Nullable public <T> com.google.common.collect.ImmutableSet<? extends AttributeValue<T>> getAttributeValuesByNameUri(@Nonnull URI name)
@Nullable public <T> AttributeDefinition<T> getDefinitionByNameUri(@Nonnull String name)
AttributeDefinition
s in the map matching the given attribute name URI (i.e. full
attribute name) or returns null
if no attribute in this map matches the given name URI.T
- the type of the AttributeDefinition
.name
- the attribute name URI to look up.AttributeDefinition
s in the map matching the given attribute name URI or returns null
when there is no match.@Nullable public <T> AttributeDefinition<T> getDefinitionByNameUri(@Nonnull URI name)
AttributeDefinition
s in the map matching the given attribute name URI (i.e. full
attribute name) or returns null
if no attribute in this map matches the given name URI.T
- the type of the AttributeDefinition
.name
- the attribute name URI to look up.AttributeDefinition
s in the map matching the given attribute name URI or returns null
when there is no match.@Nonnull public com.google.common.collect.ImmutableSet<AttributeDefinition<?>> getDefinitions()
AttributeDefinition
s in the map, can be empty but never null
.AttributeDefinition
s in the map, can be empty but never null
.@Nullable public com.google.common.collect.ImmutableSet<AttributeDefinition<?>> getDefinitionsByFriendlyName(@Nonnull String friendlyName)
AttributeDefinition
s in the map matching the given friendly name or returns null
if no attribute in this map matches the given AttributeDefinition
.friendlyName
- the attribute friendly name to look up.AttributeDefinition
s in the map matching the given friendly name or returns null
when there is no match.@Nullable public <T> AttributeValue<T> getFirstAttributeValue(@Nonnull AttributeDefinition<T> attributeDefinition)
AttributeValue
for the given AttributeDefinition
or returns null
if no
attribute in this map matches the given AttributeDefinition
.T
- the type of the AttributeValue
.attributeDefinition
- the attribute definition to look up.AttributeValue
(if any) corresponding to the given AttributeDefinition
.@Nullable public <T> T getFirstValue(@Nonnull AttributeDefinition<T> attributeDefinition)
AttributeDefinition
or returns null
if no attribute
in this map matches the given AttributeDefinition
.T
- the type of the first value (if any) corresponding to the given AttributeDefinition
.attributeDefinition
- the attribute definition to look up.AttributeDefinition
.@Nonnull public ImmutableValueMap getValueMap()
ImmutableValueMap
where keys are AttributeDefinition
s
and values are ImmutableSet
s of typed values.ImmutableValueMap
.@Nullable public <T> com.google.common.collect.ImmutableSet<? extends T> getValues(@Nonnull AttributeDefinition<T> attributeDefinition)
AttributeDefinition
as an ImmutableSet
or returns null
if no attribute in this map matches the given AttributeDefinition
.T
- the type of the values for the given AttributeDefinition
.attributeDefinition
- the attribute definition to look up.AttributeDefinition
.@Nullable public ImmutableValueMap getValuesByFriendlyName(@Nonnull String friendlyName)
null
if no
attribute in this map has that friendly name.
The returned map has AttributeDefinition
as Map keys and ImmutableSet
of typed values matching
the types of the definition as Map values.
friendlyName
- the friendly name which returned attribute keys must possessAttributeDefinition
s which have the given friendly
name and where the values are ImmutableSet
s of typed values or returns null
if no attribute in
this map has that friendly name.@Nullable public <T> com.google.common.collect.ImmutableSet<? extends T> getValuesByNameUri(@Nonnull String name)
@Nullable public <T> com.google.common.collect.ImmutableSet<? extends T> getValuesByNameUri(@Nonnull URI name)
public boolean isEmpty()
public int size()
Copyright © 2020. All Rights Reserved.