use of com.fasterxml.jackson.annotation.ObjectIdResolver in project jackson-databind by FasterXML.
the class DefaultDeserializationContext method findObjectId.
/*
/**********************************************************
/* Abstract methods impls, Object Id
/**********************************************************
*/
@Override
public ReadableObjectId findObjectId(Object id, ObjectIdGenerator<?> gen, ObjectIdResolver resolverType) {
/* 02-Apr-2015, tatu: As per [databind#742] should allow 'null', similar to how
* missing id already works.
*/
if (id == null) {
return null;
}
final ObjectIdGenerator.IdKey key = gen.key(id);
if (_objectIds == null) {
_objectIds = new LinkedHashMap<ObjectIdGenerator.IdKey, ReadableObjectId>();
} else {
ReadableObjectId entry = _objectIds.get(key);
if (entry != null) {
return entry;
}
}
// Not seen yet, must create entry and configure resolver.
ObjectIdResolver resolver = null;
if (_objectIdResolvers == null) {
_objectIdResolvers = new ArrayList<ObjectIdResolver>(8);
} else {
for (ObjectIdResolver res : _objectIdResolvers) {
if (res.canUseFor(resolverType)) {
resolver = res;
break;
}
}
}
if (resolver == null) {
resolver = resolverType.newForDeserialization(this);
_objectIdResolvers.add(resolver);
}
ReadableObjectId entry = createReadableObjectId(key);
entry.setResolver(resolver);
_objectIds.put(key, entry);
return entry;
}
Aggregations