com.fasterxml.jackson.jr.ob.impl
Class CollectionBuilder.Default

java.lang.Object
  extended by com.fasterxml.jackson.jr.ob.impl.CollectionBuilder
      extended by com.fasterxml.jackson.jr.ob.impl.CollectionBuilder.Default
Enclosing class:
CollectionBuilder

public static class CollectionBuilder.Default
extends CollectionBuilder

Default CollectionBuilder implementation, which uses ArrayList as the type of List to build, unless instructed otherwise.

When sub-classing to use different underlying mutable List type, you need to sub-class following methods:

If constructing builders that use different approaches (like, say, produce immutable Guava Lists), you may need to override more methods; or perhaps just extend basic CollectionBuilder.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.fasterxml.jackson.jr.ob.impl.CollectionBuilder
CollectionBuilder.Default
 
Field Summary
protected  Collection<Object> _current
           
 
Fields inherited from class com.fasterxml.jackson.jr.ob.impl.CollectionBuilder
_collectionType, _features, EMPTY_ARRAY
 
Constructor Summary
protected CollectionBuilder.Default(int features, Class<?> collImpl)
           
 
Method Summary
protected  Collection<Object> _list(int initialSize)
          Overridable factory method for constructing underlying List.
 CollectionBuilder add(Object value)
           
 Object[] buildArray()
          Alternative build method used when desired result type is Object[]
 Collection<Object> buildCollection()
          The usual build method to use for constructing Collection
 Collection<Object> emptyCollection()
          Specialized method that is called when an empty Collection needs to be constructed; this may be a new Collection, or an immutable shared one, depending on implementation.
 CollectionBuilder newBuilder(Class<?> collType)
           
 CollectionBuilder newBuilder(int features)
           
 CollectionBuilder start()
           
 
Methods inherited from class com.fasterxml.jackson.jr.ob.impl.CollectionBuilder
buildArray, defaultImpl, emptyArray, emptyArray, isEnabled, newBuilder, singletonArray, singletonArray, singletonCollection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_current

protected Collection<Object> _current
Constructor Detail

CollectionBuilder.Default

protected CollectionBuilder.Default(int features,
                                    Class<?> collImpl)
Method Detail

newBuilder

public CollectionBuilder newBuilder(int features)
Specified by:
newBuilder in class CollectionBuilder

newBuilder

public CollectionBuilder newBuilder(Class<?> collType)
Specified by:
newBuilder in class CollectionBuilder

start

public CollectionBuilder start()
Specified by:
start in class CollectionBuilder

buildCollection

public Collection<Object> buildCollection()
Description copied from class: CollectionBuilder
The usual build method to use for constructing Collection

Specified by:
buildCollection in class CollectionBuilder

buildArray

public Object[] buildArray()
Description copied from class: CollectionBuilder
Alternative build method used when desired result type is Object[]

Overrides:
buildArray in class CollectionBuilder

add

public CollectionBuilder add(Object value)
Specified by:
add in class CollectionBuilder

emptyCollection

public Collection<Object> emptyCollection()
Description copied from class: CollectionBuilder
Specialized method that is called when an empty Collection needs to be constructed; this may be a new Collection, or an immutable shared one, depending on implementation.

Default implementation simply calls:

  start().buildCollection();

Overrides:
emptyCollection in class CollectionBuilder

_list

protected Collection<Object> _list(int initialSize)
Overridable factory method for constructing underlying List.



Copyright © 2016 FasterXML. All rights reserved.