java.util.Collection s
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 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.
| Modifier and Type | Class and Description |
|---|---|
| public static class | CollectionBuilder.
Default |
| Modifier and Type | Field and Description |
|---|---|
| protected final Class | _collectionType
Optional |
| protected final int | |
| protected static final Object[] |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public abstract CollectionBuilder | |
| public Object[] | |
| public <T> T[] | |
| public abstract Collection | |
| public static CollectionBuilder | defaultImpl()
Factory method for getting a blueprint instance of the default
|
| public Object[] | |
| public <T> T[] | |
| public Collection | 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. |
| public final boolean | |
| public abstract CollectionBuilder | |
| public abstract CollectionBuilder | |
| public CollectionBuilder | |
| public Object[] | singletonArray(Object value)
Specialized method that is called when a single-entry array needs to be constructed. |
| public <T> T[] | |
| public Collection | singletonCollection(Object value)
Specialized method that is called when a single-entry Collection needs to be constructed. |
| public abstract CollectionBuilder |
| _collectionType | back to summary |
|---|---|
| protected final Class<?> _collectionType Optional | |
| _features | back to summary |
|---|---|
| protected final int _features | |
| EMPTY_ARRAY | back to summary |
|---|---|
| protected static final Object[] EMPTY_ARRAY | |
| CollectionBuilder | back to summary |
|---|---|
| protected CollectionBuilder(int features, Class<?> collImpl) | |
| add | back to summary |
|---|---|
| public abstract CollectionBuilder add(Object value) | |
| buildArray | back to summary |
|---|---|
| public Object[] buildArray() Alternative build method used when desired result type is
| |
| buildArray | back to summary |
|---|---|
public <T> T[] buildArray(Class<T> type)
| |
| buildCollection | back to summary |
|---|---|
| public abstract Collection The usual build method to use for constructing | |
| defaultImpl | back to summary |
|---|---|
| public static CollectionBuilder defaultImpl() Factory method for getting a blueprint instance of the default
| |
| emptyArray | back to summary |
|---|---|
| public Object[] emptyArray() Specialized method that is called when an empty Default implementation simply returns a shared empty array instance. | |
| emptyArray | back to summary |
|---|---|
public <T> T[] emptyArray(Class<T> type)
| |
| emptyCollection | back to summary |
|---|---|
| public Collection 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(); | |
| isEnabled | back to summary |
|---|---|
| public final boolean isEnabled(JSON. | |
| newBuilder | back to summary |
|---|---|
| public abstract CollectionBuilder newBuilder(int features) | |
| newBuilder | back to summary |
|---|---|
| public abstract CollectionBuilder newBuilder(Class<?> collImpl) | |
| newBuilder | back to summary |
|---|---|
| public CollectionBuilder newBuilder() | |
| singletonArray | back to summary |
|---|---|
| public Object[] singletonArray(Object value) Specialized method that is called when a single-entry array needs to be constructed. Default implementation simply returns equivalent of:
new Object[] { value }
| |
| singletonArray | back to summary |
|---|---|
| public <T> T[] singletonArray(Class<?> type, T value) | |
| singletonCollection | back to summary |
|---|---|
| public Collection Specialized method that is called when a single-entry Collection needs to be constructed. Default implementation simply calls: start().add(value).buildCollection(); | |
| start | back to summary |
|---|---|
| public abstract CollectionBuilder start() | |
CollectionBuilder implementation, which uses ArrayList
as the type of java.util.List to build, unless instructed otherwise.
When sub-classing to use different underlying mutable java.
type, you need to sub-class following methods:
newBuilder: factory method for constructing new builder instance
_list: factory method for constructing java.util.List to 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.
| Modifier and Type | Field and Description |
|---|---|
| protected Collection |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| protected Collection | |
| public CollectionBuilder | |
| public Object[] | buildArray()
Overrides com. Alternative build method used when desired result type is
|
| public Collection | buildCollection()
Implements abstract com. The usual build method to use for constructing |
| public Collection | emptyCollection()
Overrides com. 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. |
| public CollectionBuilder | newBuilder(int features)
Implements abstract com.
|
| public CollectionBuilder | newBuilder(Class<?> collType)
Implements abstract com.
|
| public CollectionBuilder |
| _current | back to summary |
|---|---|
| protected Collection<Object> _current | |
| Default | back to summary |
|---|---|
| protected Default(int features, Class<?> collImpl) | |
| _list | back to summary |
|---|---|
| protected Collection Overridable factory method for constructing underlying List. | |
| add | back to summary |
|---|---|
| public CollectionBuilder add(Object value) Implements abstract com.
| |
| buildArray | back to summary |
|---|---|
| public Object[] buildArray() Overrides com. Doc from com. Alternative build method used when desired result type is
| |
| buildCollection | back to summary |
|---|---|
| public Collection Implements abstract com. Doc from com. The usual build method to use for constructing
| |
| emptyCollection | back to summary |
|---|---|
| public Collection Overrides com. Doc from com. 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();
| |
| newBuilder | back to summary |
|---|---|
| public CollectionBuilder newBuilder(int features) Implements abstract com.
| |
| newBuilder | back to summary |
|---|---|
| public CollectionBuilder newBuilder(Class<?> collType) Implements abstract com.
| |
| start | back to summary |
|---|---|
| public CollectionBuilder start() Implements abstract com.
| |