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 interfacePMap.Builder<K,V>Container builder to be used in serialization.static classPMap.DefaultBuilder<K,V>Default map builder returning an ImmutableMap.static classPMap.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)Get an instance builder for the container.booleanequals(java.lang.Object o)java.lang.ObjectgetDefaultValue()java.lang.StringgetName()The name of the type is the Identifier string from the IDL.java.lang.StringgetQualifiedName(java.lang.String programContext)This will return the qualified name of the type given the program context.PTypegetType()inthashCode()PDescriptorkeyDescriptor()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:PDescriptorThe 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:PDescriptorThis 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:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
builder
@Nonnull public PMap.Builder<Key,Value> builder(int capacity)
Description copied from class:PContainerGet an instance builder for the container.- Specified by:
builderin classPContainer<java.util.Map<Key,Value>>- Parameters:
capacity- Requested container capacity.- Returns:
- The instance builder.
-
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)
-
-