Package com.fasterxml.jackson.jr.ob.api
Class MapBuilder
- java.lang.Object
-
- com.fasterxml.jackson.jr.ob.api.MapBuilder
-
- Direct Known Subclasses:
MapBuilder.Default
public abstract class MapBuilder extends java.lang.ObjectHelper class that is used for constructingMaps to map JSON Object values in.Objects server both as "factories" for creating new builders (blueprint style), and as actual builders. For each distinct read operation,
newBuilder(int)will be called at least once; this instance may be used and reused multiple times, as callingstart()will reset the state so that moreLists may be built.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMapBuilder.DefaultDefaultMapBuilderimplementation which builds eitherHashMaporLinkedHashMapinstances (depending onJSON.Feature.PRESERVE_FIELD_ORDERING).
-
Field Summary
Fields Modifier and Type Field Description protected boolean_checkDupsprotected int_featuresprotected java.lang.Class<?>_mapTypeOptionalMapimplementation class, used when specific implementation is desired.
-
Constructor Summary
Constructors Modifier Constructor Description protectedMapBuilder(int features, java.lang.Class<?> type)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.util.Map<java.lang.Object,java.lang.Object>build()static MapBuilderdefaultImpl()Factory method for getting a blueprint instance of the defaultMapBuilderimplementation.java.util.Map<java.lang.Object,java.lang.Object>emptyMap()Specialized method that is called when an empty list needs to be constructed; this may be a new list, or an immutable shared List, depending on implementation.booleanisEnabled(JSON.Feature f)MapBuildernewBuilder()abstract MapBuildernewBuilder(int features)abstract MapBuildernewBuilder(java.lang.Class<?> mapImpl)abstract MapBuilderput(java.lang.Object key, java.lang.Object value)java.util.Map<java.lang.Object,java.lang.Object>singletonMap(java.lang.Object key, java.lang.Object value)Specialized method that is called when an empty list needs to be constructed; this may be a new list, or an immutable shared List, depending on implementation.abstract MapBuilderstart()
-
-
-
Method Detail
-
defaultImpl
public static MapBuilder defaultImpl()
Factory method for getting a blueprint instance of the defaultMapBuilderimplementation.
-
newBuilder
public abstract MapBuilder newBuilder(int features)
-
newBuilder
public abstract MapBuilder newBuilder(java.lang.Class<?> mapImpl)
-
newBuilder
public MapBuilder newBuilder()
-
isEnabled
public final boolean isEnabled(JSON.Feature f)
-
start
public abstract MapBuilder start()
-
put
public abstract MapBuilder put(java.lang.Object key, java.lang.Object value)
-
build
public abstract java.util.Map<java.lang.Object,java.lang.Object> build()
-
emptyMap
public java.util.Map<java.lang.Object,java.lang.Object> emptyMap() throws JSONObjectExceptionSpecialized method that is called when an empty list needs to be constructed; this may be a new list, or an immutable shared List, depending on implementation.Default implementation simply calls:
start().build();
which assumes that a builder has been constructed withnewBuilder(int)- Throws:
JSONObjectException
-
singletonMap
public java.util.Map<java.lang.Object,java.lang.Object> singletonMap(java.lang.Object key, java.lang.Object value) throws JSONObjectExceptionSpecialized method that is called when an empty list needs to be constructed; this may be a new list, or an immutable shared List, depending on implementation.Default implementation simply calls:
start().put(key, value).build();
- Throws:
JSONObjectException
-
-