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.couchbase.client.deps.com.fasterxml.jackson.databind.type;
import java.lang.reflect.Array;
import com.couchbase.client.deps.com.fasterxml.jackson.databind.JavaType;
/**
* Array types represent Java arrays, both primitive and object valued.
* Further, Object-valued arrays can have element type of any other
* legal {@link JavaType}.
*/
public final class ArrayType
extends TypeBase
{
private static final long serialVersionUID = 9040058063449087477L;
/**
* Type of elements in the array.
*/
protected final JavaType _componentType;
/**
* We will also keep track of shareable instance of empty array,
* since it usually needs to be constructed any way; and because
* it is essentially immutable and thus can be shared.
*/
protected final Object _emptyArray;
private ArrayType(JavaType componentType, Object emptyInstance,
Object valueHandler, Object typeHandler, boolean asStatic)
{
super(emptyInstance.getClass(), componentType.hashCode(),
valueHandler, typeHandler, asStatic);
_componentType = componentType;
_emptyArray = emptyInstance;
}
public static ArrayType construct(JavaType componentType,
Object valueHandler, Object typeHandler)
{
/* This is bit messy: there is apparently no other way to
* reconstruct actual concrete/raw array class from component
* type, than to construct an instance, get class (same is
* true for GenericArracyType as well; hence we won't bother
* passing that in).
*/
Object emptyInstance = Array.newInstance(componentType.getRawClass(), 0);
return new ArrayType(componentType, emptyInstance, null, null, false);
}
@Override
public ArrayType withTypeHandler(Object h)
{
if (h == _typeHandler) {
return this;
}
return new ArrayType(_componentType, _emptyArray, _valueHandler, h, _asStatic);
}
@Override
public ArrayType withContentTypeHandler(Object h)
{
if (h == _componentType.