Top Description Inners Fields Constructors Methods
com.fasterxml.jackson.jr.ob.api

public abstract Class MapBuilder

extends Object
Class Inheritance
Known Direct Subclasses
com.fasterxml.jackson.jr.ob.api.MapBuilder.Default
Imports
java.util.*, com.fasterxml.jackson.jr.ob.JSON, .JSON.Feature, .JSONObjectException, com.fasterxml.jackson.jr.ob.impl.DeferredMap

Helper class that is used for constructing java.util.Maps 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 will be called at least once; this instance may be used and reused multiple times, as calling start will reset the state so that more Lists may be built.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
MapBuilder.Default

Default MapBuilder implementation which builds either HashMap or LinkedHashMap instances (depending on Feature#PRESERVE_FIELD_ORDERING).

Field Summary

Modifier and TypeField and Description
protected final boolean
protected final int
protected final Class<?>
_mapType

Optional Map implementation class, used when specific implementation is desired.

Constructor Summary

AccessConstructor and Description
protected
MapBuilder(int features, Class<?> type)

Method Summary

Modifier and TypeMethod and Description
public abstract Map<String, Object>
public static MapBuilder
defaultImpl()

Factory method for getting a blueprint instance of the default MapBuilder implementation.

public Map<String, 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.

public final boolean
public abstract MapBuilder
newBuilder(int features)

public abstract MapBuilder
newBuilder(Class<?> mapImpl)

public MapBuilder
public abstract MapBuilder
put(String key, Object value)

public Map<String, Object>
singletonMap(String 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.

public abstract MapBuilder
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_checkDupsback to summary
protected final boolean _checkDups
_featuresback to summary
protected final int _features
_mapTypeback to summary
protected final Class<?> _mapType

Optional Map implementation class, used when specific implementation is desired.

Constructor Detail

MapBuilderback to summary
protected MapBuilder(int features, Class<?> type)

Method Detail

buildback to summary
public abstract Map<String, Object> build()
defaultImplback to summary
public static MapBuilder defaultImpl()

Factory method for getting a blueprint instance of the default MapBuilder implementation.

emptyMapback to summary
public Map<String, 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 with newBuilder
isEnabledback to summary
public final boolean isEnabled(JSON.Feature f)
newBuilderback to summary
public abstract MapBuilder newBuilder(int features)
newBuilderback to summary
public abstract MapBuilder newBuilder(Class<?> mapImpl)
newBuilderback to summary
public MapBuilder newBuilder()
putback to summary
public abstract MapBuilder put(String key, Object value)
singletonMapback to summary
public Map<String, Object> singletonMap(String 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();
startback to summary
public abstract MapBuilder start()
com.fasterxml.jackson.jr.ob.api back to summary

public Class MapBuilder.Default

extends MapBuilder
Class Inheritance

Default MapBuilder implementation which builds either HashMap or LinkedHashMap instances (depending on Feature#PRESERVE_FIELD_ORDERING). It may also, with alternate configuration, use Collections#emptyMap() for empty Maps, if allowed with Feature#READ_ONLY.

Field Summary

Modifier and TypeField and Description
protected Map<String, Object>
Inherited from com.fasterxml.jackson.jr.ob.api.MapBuilder:
_checkDups_features_mapType

Constructor Summary

AccessConstructor and Description
protected
Default(int features, Class<?> type)

Method Summary

Modifier and TypeMethod and Description
private final Map<String, Object>
_map(int initialSize)

public Map<String, Object>
public Map<String, Object>
emptyMap()

Overrides com.fasterxml.jackson.jr.ob.api.MapBuilder.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.

public MapBuilder
public MapBuilder
public MapBuilder
public MapBuilder
Inherited from com.fasterxml.jackson.jr.ob.api.MapBuilder:
defaultImplisEnablednewBuildersingletonMap

Field Detail

_currentback to summary
protected Map<String, Object> _current

Constructor Detail

Defaultback to summary
protected Default(int features, Class<?> type)

Method Detail

_mapback to summary
private final Map<String, Object> _map(int initialSize)
buildback to summary
public Map<String, Object> build()

Implements abstract com.fasterxml.jackson.jr.ob.api.MapBuilder.build.

Annotations
@Override
emptyMapback to summary
public Map<String, Object> emptyMap()

Overrides com.fasterxml.jackson.jr.ob.api.MapBuilder.emptyMap.

Doc from com.fasterxml.jackson.jr.ob.api.MapBuilder.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.

Default implementation simply calls:

  start().build();
which assumes that a builder has been constructed with newBuilder
Annotations
@Override
newBuilderback to summary
public MapBuilder newBuilder(int features)

Implements abstract com.fasterxml.jackson.jr.ob.api.MapBuilder.newBuilder.

Annotations
@Override
newBuilderback to summary
public MapBuilder newBuilder(Class<?> mapImpl)

Implements abstract com.fasterxml.jackson.jr.ob.api.MapBuilder.newBuilder.

Annotations
@Override
putback to summary
public MapBuilder put(String key, Object value)

Implements abstract com.fasterxml.jackson.jr.ob.api.MapBuilder.put.

Annotations
@Override
startback to summary
public MapBuilder start()

Implements abstract com.fasterxml.jackson.jr.ob.api.MapBuilder.start.

Annotations
@Override