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.
Ehcache is an open source, standards-based cache used to boost performance,
offload the database and simplify scalability. Ehcache is robust, proven and full-featured and
this has made it the most widely-used Java-based cache.
package com.fasterxml.jackson.databind;
import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import com.fasterxml.jackson.annotation.ObjectIdGenerator;
import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.databind.cfg.ContextAttributes;
import com.fasterxml.jackson.databind.deser.*;
import com.fasterxml.jackson.databind.deser.impl.ReadableObjectId;
import com.fasterxml.jackson.databind.deser.impl.TypeWrappedDeserializer;
import com.fasterxml.jackson.databind.exc.InvalidFormatException;
import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException;
import com.fasterxml.jackson.databind.introspect.Annotated;
import com.fasterxml.jackson.databind.jsontype.TypeDeserializer;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.type.TypeFactory;
import com.fasterxml.jackson.databind.util.*;
/**
* Context for the process of deserialization a single root-level value.
* Used to allow passing in configuration settings and reusable temporary
* objects (scrap arrays, containers).
*
* Instance life-cycle is such that an partially configured "blueprint" object
* is registered with {@link ObjectMapper} (and {@link ObjectReader},
* and when an actual instance is needed for deserialization,
* a fully configured instance will
* be created using a method in excented API of sub-class
* ({@link com.fasterxml.jackson.databind.deser.DefaultDeserializationContext#createInstance}).
* Each instance is guaranteed to only be used from single-threaded context;
* instances may be reused iff no configuration has changed.
*
* Defined as abstract class so that implementations must define methods
* for reconfiguring blueprints and creating instances.
*/
public abstract class DeserializationContext
extends DatabindContext
implements java.io.Serializable
{
private static final long serialVersionUID = -7727373309391091315L;
/**
* Let's limit length of error messages, for cases where underlying data
* may be very large -- no point in spamming logs with megs of meaningless
* data.
*/
private final static int MAX_ERROR_STR_LEN = 500;
/*
/**********************************************************
/* Configuration, immutable
/**********************************************************
*/
/**
* Object that handle details of {@link JsonDeserializer} caching.
*/
protected final DeserializerCache _cache;
/*
/**********************************************************
/* Configuration, changeable via fluent factories
/**********************************************************
*/
/**
* Read-only factory instance; exposed to let
* owners (ObjectMapper, ObjectReader)
* access it.
*/
protected final DeserializerFactory _factory;
/*
/**********************************************************
/* Configuration that gets set for instances (not blueprints)
/* (partly denormalized for performance)
/**********************************************************
*/
/**
* Generic deserialization processing configuration
*/
protected final DeserializationConfig _config;
/**
* Bitmap of {@link DeserializationFeature}s that are enabled
*/
protected final int _featureFlags;
/**
* Currently active view, if any.
*/
protected final Class> _view;
/**
* Currently active parser used for deserialization.
* May be different from the outermost parser
* when content is buffered.
*/
protected transient JsonParser _parser;
/**
* Object used for resolving references to injectable
* values.
*/
protected final InjectableValues _injectableValues;
/*
/**********************************************************
/* Per-operation reusable helper objects (not for blueprints)
/**********************************************************
*/
protected transient ArrayBuilders _arrayBuilders;
protected transient ObjectBuffer _objectBuffer;
protected transient DateFormat _dateFormat;
/**
* Lazily-constructed holder for per-call attributes.
*
* @since 2.3
*/
protected transient ContextAttributes _attributes;
/*
/**********************************************************
/* Life-cycle
/**********************************************************
*/
protected DeserializationContext(DeserializerFactory df) {
this(df, null);
}
protected DeserializationContext(DeserializerFactory df,
DeserializerCache cache)
{
if (df == null) {
throw new IllegalArgumentException("Can not pass null DeserializerFactory");
}
_factory = df;
_cache = (cache == null) ? new DeserializerCache() : cache;
_featureFlags = 0;
_config = null;
_injectableValues = null;
_view = null;
_attributes = null;
}
protected DeserializationContext(DeserializationContext src,
DeserializerFactory factory)
{
_cache = src._cache;
_factory = factory;
_config = src._config;
_featureFlags = src._featureFlags;
_view = src._view;
_parser = src._parser;
_injectableValues = src._injectableValues;
_attributes = src._attributes;
}
/**
* Constructor used for creating actual per-call instances.
*/
protected DeserializationContext(DeserializationContext src,
DeserializationConfig config, JsonParser jp,
InjectableValues injectableValues)
{
_cache = src._cache;
_factory = src._factory;
_config = config;
_featureFlags = config.getDeserializationFeatures();
_view = config.getActiveView();
_parser = jp;
_injectableValues = injectableValues;
_attributes = config.getAttributes();
}
/*
/**********************************************************
/* DatabindContext implementation
/**********************************************************
*/
@Override
public DeserializationConfig getConfig() { return _config; }
@Override
public final Class> getActiveView() { return _view; }
@Override
public final AnnotationIntrospector getAnnotationIntrospector() {
return _config.getAnnotationIntrospector();
}
@Override
public final TypeFactory getTypeFactory() {
return _config.getTypeFactory();
}
/*
/**********************************************************
/* Generic attributes (2.3+)
/**********************************************************
*/
@Override
public Object getAttribute(Object key) {
return _attributes.getAttribute(key);
}
@Override
public DeserializationContext setAttribute(Object key, Object value)
{
_attributes = _attributes.withPerCallAttribute(key, value);
return this;
}
/*
/**********************************************************
/* Public API, accessors
/**********************************************************
*/
/**
* Method for getting current {@link DeserializerFactory}.
*/
public DeserializerFactory getFactory() {
return _factory;
}
/**
* Convenience method for checking whether specified on/off
* feature is enabled
*/
public final boolean isEnabled(DeserializationFeature feat) {
/* 03-Dec-2010, tatu: minor shortcut; since this is called quite often,
* let's use a local copy of feature settings:
*/
return (_featureFlags & feat.getMask()) != 0;
}
/**
* "Bulk" access method for checking that all features specified by
* mask are enabled.
*
* @since 2.3
*/
public final boolean hasDeserializationFeatures(int featureMask) {
return _config.hasDeserializationFeatures(featureMask);
}
/**
* Method for accessing the currently active parser.
* May be different from the outermost parser
* when content is buffered.
*
* Use of this method is discouraged: if code has direct access
* to the active parser, that should be used instead.
*/
public final JsonParser getParser() { return _parser; }
public final Object findInjectableValue(Object valueId,
BeanProperty forProperty, Object beanInstance)
{
if (_injectableValues == null) {
throw new IllegalStateException("No 'injectableValues' configured, can not inject value with id ["+valueId+"]");
}
return _injectableValues.findInjectableValue(valueId, this, forProperty, beanInstance);
}
/**
* Convenience method for accessing the default Base64 encoding
* used for decoding base64 encoded binary content.
* Same as calling:
*
* getConfig().getBase64Variant();
*
*/
public final Base64Variant getBase64Variant() {
return _config.getBase64Variant();
}
/**
* Convenience method, functionally equivalent to:
*
* getConfig().getNodeFactory();
*
*/
public final JsonNodeFactory getNodeFactory() {
return _config.getNodeFactory();
}
/**
* Method for accessing default Locale to use: convenience method for
*
* getConfig().getLocale();
*
*/
public Locale getLocale() {
return _config.getLocale();
}
/**
* Method for accessing default TimeZone to use: convenience method for
*
* getConfig().getTimeZone();
*
*/
public TimeZone getTimeZone() {
return _config.getTimeZone();
}
/*
/**********************************************************
/* Public API, pass-through to DeserializerCache
/**********************************************************
*/
@Deprecated // since 2.3, use overloaded variant
public boolean hasValueDeserializerFor(JavaType type) {
return hasValueDeserializerFor(type, null);
}
/**
* Method for checking whether we could find a deserializer
* for given type.
*
* @param type
* @since 2.3
*/
public boolean hasValueDeserializerFor(JavaType type, AtomicReference cause) {
try {
return _cache.hasValueDeserializerFor(this, _factory, type);
} catch (JsonMappingException e) {
if (cause != null) {
cause.set(e);
}
} catch (RuntimeException e) {
if (cause == null) { // earlier behavior
throw e;
}
cause.set(e);
}
return false;
}
/**
* Method for finding a value deserializer, and creating a contextual
* version if necessary, for value reached via specified property.
*/
@SuppressWarnings("unchecked")
public final JsonDeserializer