@Immutable @ThreadSafe public final class ImmutableValueMap extends Object implements Serializable
AttributeDefinition
s to typed values.Modifier and Type | Class and Description |
---|---|
static class |
ImmutableValueMap.Builder
Builder pattern for the
ImmutableValueMap class. |
Modifier and Type | Method and Description |
---|---|
static ImmutableValueMap.Builder |
builder() |
static ImmutableValueMap.Builder |
builder(ImmutableValueMap.Builder copy) |
static ImmutableValueMap.Builder |
builder(ImmutableValueMap copy) |
static ImmutableValueMap.Builder |
builder(Map<AttributeDefinition<?>,? extends Iterable<?>> copy) |
static ImmutableValueMap |
copyOf(Map<AttributeDefinition<?>,? extends Iterable<?>> map) |
boolean |
equals(Object o) |
<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> 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 . |
com.google.common.collect.ImmutableMap<AttributeDefinition<?>,com.google.common.collect.ImmutableSet<?>> |
getMap()
Returns the content of this object as an
ImmutableMap where keys are AttributeDefinition s and
values are ImmutableSet s of typed values. |
<T> com.google.common.collect.ImmutableSet<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<T> |
getValuesByNameUri(String name) |
<T> com.google.common.collect.ImmutableSet<T> |
getValuesByNameUri(URI name) |
int |
hashCode() |
boolean |
isEmpty() |
static ImmutableValueMap |
of() |
static <T> ImmutableValueMap |
of(AttributeDefinition<T> attributeDefinition,
Iterable<T> values) |
static <T> ImmutableValueMap |
of(AttributeDefinition<T> attributeDefinition,
T... values) |
int |
size() |
String |
toString() |
@Nonnull public static ImmutableValueMap.Builder builder()
@Nonnull public static ImmutableValueMap.Builder builder(@Nonnull ImmutableValueMap.Builder copy)
@Nonnull public static ImmutableValueMap.Builder builder(@Nonnull ImmutableValueMap copy)
@Nonnull public static ImmutableValueMap.Builder builder(@Nonnull Map<AttributeDefinition<?>,? extends Iterable<?>> copy)
@Nonnull public static ImmutableValueMap copyOf(@Nonnull Map<AttributeDefinition<?>,? extends Iterable<?>> map)
@Nonnull public static ImmutableValueMap of()
@Nonnull public static <T> ImmutableValueMap of(@Nonnull AttributeDefinition<T> attributeDefinition, @Nonnull Iterable<T> values)
@Nonnull public static <T> ImmutableValueMap of(@Nonnull AttributeDefinition<T> attributeDefinition, @Nonnull T... values)
@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> 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 com.google.common.collect.ImmutableMap<AttributeDefinition<?>,com.google.common.collect.ImmutableSet<?>> getMap()
ImmutableMap
where keys are AttributeDefinition
s and
values are ImmutableSet
s of typed values.ImmutableMap
.@Nullable public <T> com.google.common.collect.ImmutableSet<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
s as Map keys and ImmutableSet
of typed values 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<T> getValuesByNameUri(@Nonnull String name)
@Nullable public <T> com.google.common.collect.ImmutableSet<T> getValuesByNameUri(@Nonnull URI name)
public boolean isEmpty()
public int size()
Copyright © 2020. All Rights Reserved.