com.fasterxml.jackson.jr.ob.impl
Class MapBuilder

java.lang.Object
  extended by com.fasterxml.jackson.jr.ob.impl.MapBuilder
Direct Known Subclasses:
MapBuilder.Default

public abstract class MapBuilder
extends Object

Helper class that is used for constructing 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(int) 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 Class Summary
static class MapBuilder.Default
          Default MapBuilder implementation which builds either HashMap or LinkedHashMap instances (depending on JSON.Feature.PRESERVE_FIELD_ORDERING).
 
Field Summary
protected  int _features
           
protected  Class<?> _mapType
          Optional Map implementation class, used when specific implementation is desired.
 
Constructor Summary
protected MapBuilder(int features, Class<?> type)
           
 
Method Summary
abstract  Map<Object,Object> build()
           
static MapBuilder defaultImpl()
          Factory method for getting a blueprint instance of the default MapBuilder 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(Class<?> mapImpl)
           
abstract  MapBuilder newBuilder(int features)
           
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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_features

protected final int _features

_mapType

protected final Class<?> _mapType
Optional Map implementation class, used when specific implementation is desired.

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 default MapBuilder 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)

build

public abstract Map<Object,Object> build()

emptyMap

public 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.

Default implementation simply calls:

  start().build();
which assumes that a builder has been constructed with newBuilder(int)


singletonMap

public 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.

Default implementation simply calls:

  start().put(key, value).build();



Copyright © 2016 FasterXML. All rights reserved.