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.
Google HTTP Client Library for Java. Functionality that works on all supported Java platforms,
including Java 5 (or higher) desktop (SE) and web (EE), Android, and Google App Engine.
/*
* Copyright (c) 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.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