Package com.fasterxml.jackson.jr.ob.api
Class CollectionBuilder
java.lang.Object
com.fasterxml.jackson.jr.ob.api.CollectionBuilder
- Direct Known Subclasses:
CollectionBuilder.Default
Helper class that is used for constructing
Collections
to map JSON Array 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 Collections may be built.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDefaultCollectionBuilderimplementation, which usesArrayListas the type ofListto build, unless instructed otherwise. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Class<?>OptionalCollectionimplementation class, used when specific implementation is desired.protected final intprotected static final Object[] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract CollectionBuilderObject[]Alternative build method used when desired result type isObject[]<T> T[]buildArray(Class<T> type) abstract Collection<Object>The usual build method to use for constructingCollectionstatic CollectionBuilderFactory method for getting a blueprint instance of the defaultCollectionBuilderimplementation.Object[]Specialized method that is called when an emptyObject[]needs to be returned.<T> T[]emptyArray(Class<T> type) 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.final booleanabstract CollectionBuildernewBuilder(int features) abstract CollectionBuildernewBuilder(Class<?> collImpl) <T> T[]singletonArray(Class<?> type, T value) Object[]singletonArray(Object value) Specialized method that is called when a single-entry array needs to be constructed.singletonCollection(Object value) Specialized method that is called when a single-entry Collection needs to be constructed.abstract CollectionBuilderstart()
-
Field Details
-
EMPTY_ARRAY
-
_features
protected final int _features -
_collectionType
OptionalCollectionimplementation class, used when specific implementation is desired.
-
-
Constructor Details
-
CollectionBuilder
-
-
Method Details
-
defaultImpl
Factory method for getting a blueprint instance of the defaultCollectionBuilderimplementation. -
newBuilder
-
newBuilder
-
newBuilder
-
isEnabled
-
start
-
add
-
buildCollection
The usual build method to use for constructingCollection -
buildArray
Alternative build method used when desired result type isObject[] -
buildArray
-
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.Default implementation simply calls:
start().buildCollection();
-
emptyArray
Specialized method that is called when an emptyObject[]needs to be returned.Default implementation simply returns a shared empty array instance.
-
emptyArray
-
singletonCollection
Specialized method that is called when a single-entry Collection needs to be constructed.Default implementation simply calls:
start().add(value).buildCollection();
-
singletonArray
Specialized method that is called when a single-entry array needs to be constructed.Default implementation simply returns equivalent of:
new Object[] { value } -
singletonArray
-