Class PMap<Key,Value>
- java.lang.Object
-
- net.morimekta.providence.descriptor.PContainer<java.util.Map<Key,Value>>
-
- net.morimekta.providence.descriptor.PMap<Key,Value>
-
- All Implemented Interfaces:
PDescriptor
public class PMap<Key,Value> extends PContainer<java.util.Map<Key,Value>>
Descriptor for a map with key and item type.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
PMap.Builder<K,V>
Container builder to be used in serialization.static class
PMap.DefaultBuilder<K,V>
Default map builder returning an ImmutableMap.static class
PMap.SortedBuilder<K extends java.lang.Comparable,V>
Sorted map builder returning an ImmutableSortedMap.-
Nested classes/interfaces inherited from class net.morimekta.providence.descriptor.PContainer
PContainer.Type
-
-
Constructor Summary
Constructors Constructor Description PMap(PDescriptorProvider keyDesc, PDescriptorProvider itemDesc, java.util.function.IntFunction<PMap.Builder<Key,Value>> builderSupplier)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PMap.Builder<Key,Value>
builder(int capacity)
boolean
equals(java.lang.Object o)
java.lang.Object
getDefaultValue()
java.lang.String
getName()
The name of the type is the Identifier string from the IDL.java.lang.String
getQualifiedName(java.lang.String programContext)
This will return the qualified name of the type given the program context.PType
getType()
int
hashCode()
PDescriptor
keyDescriptor()
static <K,V>
PContainerProvider<java.util.Map<K,V>,PMap<K,V>>orderedProvider(PDescriptorProvider keyDesc, PDescriptorProvider itemDesc)
static <K,V>
PContainerProvider<java.util.Map<K,V>,PMap<K,V>>provider(PDescriptorProvider keyDesc, PDescriptorProvider itemDesc)
static <K extends java.lang.Comparable<K>,V>
PContainerProvider<java.util.Map<K,V>,PMap<K,V>>sortedProvider(PDescriptorProvider keyDesc, PDescriptorProvider itemDesc)
-
Methods inherited from class net.morimekta.providence.descriptor.PContainer
getProgramName, itemDescriptor, toString, typeForName
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.morimekta.providence.descriptor.PDescriptor
getQualifiedName
-
-
-
-
Constructor Detail
-
PMap
public PMap(PDescriptorProvider keyDesc, PDescriptorProvider itemDesc, java.util.function.IntFunction<PMap.Builder<Key,Value>> builderSupplier)
-
-
Method Detail
-
keyDescriptor
public PDescriptor keyDescriptor()
-
getName
@Nonnull public java.lang.String getName()
Description copied from interface:PDescriptor
The name of the type is the Identifier string from the IDL.- Returns:
- The name of the type. Not including package.
-
getQualifiedName
@Nonnull public java.lang.String getQualifiedName(java.lang.String programContext)
Description copied from interface:PDescriptor
This will return the qualified name of the type given the program context.- Parameters:
programContext
- The program which the type should be referenced from.- Returns:
- The qualified name of the type. Including program if not matching with programContext.
-
getType
@Nonnull public PType getType()
- Returns:
- Get the field type.
-
getDefaultValue
@Nullable public java.lang.Object getDefaultValue()
- Returns:
- The default value for the type used for default and required fields. Note that some primitive types don't support null values, and will have methods returning a default value regardless of the field required value setting.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
builder
@Nonnull public PMap.Builder<Key,Value> builder(int capacity)
-
provider
@Nonnull public static <K,V> PContainerProvider<java.util.Map<K,V>,PMap<K,V>> provider(PDescriptorProvider keyDesc, PDescriptorProvider itemDesc)
-
sortedProvider
@Nonnull public static <K extends java.lang.Comparable<K>,V> PContainerProvider<java.util.Map<K,V>,PMap<K,V>> sortedProvider(PDescriptorProvider keyDesc, PDescriptorProvider itemDesc)
-
orderedProvider
@Nonnull public static <K,V> PContainerProvider<java.util.Map<K,V>,PMap<K,V>> orderedProvider(PDescriptorProvider keyDesc, PDescriptorProvider itemDesc)
-
-