package com.fasterxml.jackson.databind.deser.std;
import java.util.concurrent.atomic.AtomicReference;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.deser.ValueInstantiator;
import com.fasterxml.jackson.databind.jsontype.TypeDeserializer;
public class AtomicReferenceDeserializer
extends ReferenceTypeDeserializer<AtomicReference<Object>>
{
private static final long serialVersionUID = 1L;
public AtomicReferenceDeserializer(JavaType fullType, ValueInstantiator inst,
TypeDeserializer typeDeser, JsonDeserializer<?> deser)
{
super(fullType, inst, typeDeser, deser);
}
@Override
public AtomicReferenceDeserializer withResolved(TypeDeserializer typeDeser, JsonDeserializer<?> valueDeser) {
return new AtomicReferenceDeserializer(_fullType, _valueInstantiator,
typeDeser, valueDeser);
}
@Override
public AtomicReference<Object> getNullValue(DeserializationContext ctxt) throws JsonMappingException {
return new AtomicReference<Object>(_valueDeserializer.getNullValue(ctxt));
}
@Override
public Object getEmptyValue(DeserializationContext ctxt) throws JsonMappingException {
return getNullValue(ctxt);
}
@Override
public AtomicReference<Object> referenceValue(Object contents) {
return new AtomicReference<Object>(contents);
}
@Override
public Object getReferenced(AtomicReference<Object> reference) {
return reference.get();
}
@Override
public AtomicReference<Object> updateReference(AtomicReference<Object> reference, Object contents) {
reference.set(contents);
return reference;
}
@Override
public Boolean supportsUpdate(DeserializationConfig config) {
return Boolean.TRUE;
}
}