public abstract class AbstractObjectArrayToJsonConverter extends java.lang.Object implements ObjectArrayToJsonConverter
ObjectArrayToJsonConverter encapsulating functionality common
to all implementations.Iterable,
Map,
ObjectArrayToJsonConverter| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
BEGIN_ARRAY |
protected static java.lang.String |
EMPTY_STRING |
protected static java.lang.String |
END_ARRAY |
protected static java.lang.String |
JSON_OBJECT_SEPARATOR |
| Constructor and Description |
|---|
AbstractObjectArrayToJsonConverter() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
convert(java.lang.Iterable<?> iterable)
Converts the given
Iterable of Objects into a JSON array. |
<K,V> java.lang.String |
convert(java.util.Map<K,V> map)
Converts the
values from the given Map into JSON. |
protected ObjectToJsonConverter |
getObjectToJsonConverter()
Returns a reference to the configured
ObjectToJsonConverter used to convert
individual Objects into JSON. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitconvertprotected static final java.lang.String BEGIN_ARRAY
protected static final java.lang.String EMPTY_STRING
protected static final java.lang.String END_ARRAY
protected static final java.lang.String JSON_OBJECT_SEPARATOR
@NonNull protected ObjectToJsonConverter getObjectToJsonConverter()
ObjectToJsonConverter used to convert
individual Objects into JSON.ObjectToJsonConverter; never null.ObjectToJsonConverter@NonNull
public java.lang.String convert(@NonNull
java.lang.Iterable<?> iterable)
Iterable of Objects into a JSON array.convert in interface org.springframework.core.convert.converter.Converter<java.lang.Iterable<?>,java.lang.String>iterable - Iterable containing the Objects to convert into JSON;
must not be null.JSON generated from the given Iterable of Objects;
never null.java.lang.IllegalArgumentException - if Iterable is null.getObjectToJsonConverter(),
Iterable@NonNull
public <K,V> java.lang.String convert(@Nullable
java.util.Map<K,V> map)
values from the given Map into JSON.K - Class type of the keys.V - Class type of the values.map - Map containing the values to convert into JSON.JSON generated from the values in the given Map.convert(Iterable),
Map