Package com.fasterxml.jackson.jr.ob.impl
Class MapBuilder
- java.lang.Object
-
- com.fasterxml.jackson.jr.ob.impl.MapBuilder
-
- Direct Known Subclasses:
MapBuilder.Default
public abstract class MapBuilder extends Object
Helper class that is used for constructingMap
s 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 moreList
s may be built.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MapBuilder.Default
DefaultMapBuilder
implementation which builds eitherHashMap
orLinkedHashMap
instances (depending onJSON.Feature.PRESERVE_FIELD_ORDERING
).
-
Field Summary
Fields Modifier and Type Field Description protected boolean
_checkDups
protected int
_features
protected Class<?>
_mapType
OptionalMap
implementation class, used when specific implementation is desired.
-
Constructor Summary
Constructors Modifier Constructor Description protected
MapBuilder(int features, Class<?> type)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Map<Object,Object>
build()
static MapBuilder
defaultImpl()
Factory method for getting a blueprint instance of the defaultMapBuilder
implementation.Map<Object,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.boolean
isEnabled(JSON.Feature f)
MapBuilder
newBuilder()
abstract MapBuilder
newBuilder(int features)
abstract MapBuilder
newBuilder(Class<?> mapImpl)
abstract MapBuilder
put(Object key, Object value)
Map<Object,Object>
singletonMap(Object key, 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 MapBuilder
start()
-
-
-
Constructor Detail
-
MapBuilder
protected MapBuilder(int features, Class<?> type)
-
-
Method Detail
-
defaultImpl
public static MapBuilder defaultImpl()
Factory method for getting a blueprint instance of the defaultMapBuilder
implementation.
-
newBuilder
public abstract MapBuilder newBuilder(int features)
-
newBuilder
public abstract MapBuilder newBuilder(Class<?> mapImpl)
-
newBuilder
public MapBuilder newBuilder()
-
isEnabled
public final boolean isEnabled(JSON.Feature f)
-
start
public abstract MapBuilder start()
-
put
public abstract MapBuilder put(Object key, Object value)
-
emptyMap
public Map<Object,Object> emptyMap() throws JSONObjectException
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.Default implementation simply calls:
start().build();
which assumes that a builder has been constructed withnewBuilder(int)
- Throws:
JSONObjectException
-
singletonMap
public Map<Object,Object> singletonMap(Object key, Object value) throws JSONObjectException
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.Default implementation simply calls:
start().put(key, value).build();
- Throws:
JSONObjectException
-
-