Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package com.rt.storage.api.client.util;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Map;
import java.util.concurrent.ConcurrentMap;
/**
* Collects the array values of a key/value data object, writing the fields or map values only after
* all values have been collected.
*
*
The typical application for this is when parsing JSON or XML when the value type is known to
* be an array. It stores the values in a collection during the parsing, and only when the parsing
* of an object is finished does it convert the collection into an array and stores it.
*
*
Use {@link #put(String, Class, Object)} when the destination object is a map with string keys
* and whose values accept an array of objects. Use {@link #put(Field, Class, Object)} when setting
* the value of a field using reflection, assuming its type accepts an array of objects. One can
* potentially use both {@code put} methods for example on an instance of {@link GenericData}.
*
*
Implementation is not thread-safe. For a thread-safe choice instead use an implementation of
* {@link ConcurrentMap}.
*
* @since 1.4
* @author Yaniv Inbar
*/
public final class ArrayValueMap {
/** Array values on a particular field. */
static class ArrayValue {
/** Array component type. */
final Class> componentType;
/** Values to be stored in the array. */
final ArrayList