Package com.fasterxml.jackson.jr.ob.impl
Class CollectionBuilder.Default
- java.lang.Object
-
- com.fasterxml.jackson.jr.ob.impl.CollectionBuilder
-
- com.fasterxml.jackson.jr.ob.impl.CollectionBuilder.Default
-
- Enclosing class:
- CollectionBuilder
public static class CollectionBuilder.Default extends CollectionBuilder
DefaultCollectionBuilderimplementation, which usesArrayListas the type ofListto build, unless instructed otherwise.When sub-classing to use different underlying mutable
Listtype, you need to sub-class following methods:newBuilder(int): factory method for constructing new builder instance_list(int): factory method for constructingListto build
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
Fields Modifier and Type Field Description protected Collection<Object>_current-
Fields inherited from class com.fasterxml.jackson.jr.ob.impl.CollectionBuilder
_collectionType, _features, EMPTY_ARRAY
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Collection<Object>_list(int initialSize)Overridable factory method for constructing underlying List.CollectionBuilderadd(Object value)Object[]buildArray()Alternative build method used when desired result type isObject[]Collection<Object>buildCollection()The usual build method to use for constructingCollectionCollection<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.CollectionBuildernewBuilder(int features)CollectionBuildernewBuilder(Class<?> collType)CollectionBuilderstart()-
Methods inherited from class com.fasterxml.jackson.jr.ob.impl.CollectionBuilder
buildArray, defaultImpl, emptyArray, emptyArray, isEnabled, newBuilder, singletonArray, singletonArray, singletonCollection
-
-
-
-
Field Detail
-
_current
protected Collection<Object> _current
-
-
Constructor Detail
-
Default
protected Default(int features, Class<?> collImpl)
-
-
Method Detail
-
newBuilder
public CollectionBuilder newBuilder(int features)
- Specified by:
newBuilderin classCollectionBuilder
-
newBuilder
public CollectionBuilder newBuilder(Class<?> collType)
- Specified by:
newBuilderin classCollectionBuilder
-
start
public CollectionBuilder start()
- Specified by:
startin classCollectionBuilder
-
buildCollection
public Collection<Object> buildCollection()
Description copied from class:CollectionBuilderThe usual build method to use for constructingCollection- Specified by:
buildCollectionin classCollectionBuilder
-
buildArray
public Object[] buildArray()
Description copied from class:CollectionBuilderAlternative build method used when desired result type isObject[]- Overrides:
buildArrayin classCollectionBuilder
-
add
public CollectionBuilder add(Object value)
- Specified by:
addin classCollectionBuilder
-
emptyCollection
public Collection<Object> emptyCollection()
Description copied from class:CollectionBuilderSpecialized 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:
emptyCollectionin classCollectionBuilder
-
_list
protected Collection<Object> _list(int initialSize)
Overridable factory method for constructing underlying List.
-
-