Search in sources :

Example 1 with IdKey

use of com.fasterxml.jackson.annotation.ObjectIdGenerator.IdKey in project jackson-databind by FasterXML.

the class DefaultDeserializationContext method checkUnresolvedObjectId.

@Override
public void checkUnresolvedObjectId() throws UnresolvedForwardReference {
    if (_objectIds == null) {
        return;
    }
    // 29-Dec-2014, tatu: As per [databind#299], may also just let unresolved refs be...
    if (!isEnabled(DeserializationFeature.FAIL_ON_UNRESOLVED_OBJECT_IDS)) {
        return;
    }
    UnresolvedForwardReference exception = null;
    for (Entry<IdKey, ReadableObjectId> entry : _objectIds.entrySet()) {
        ReadableObjectId roid = entry.getValue();
        if (!roid.hasReferringProperties()) {
            continue;
        }
        // as per [databind#675], allow resolution at this point
        if (tryToResolveUnresolvedObjectId(roid)) {
            continue;
        }
        if (exception == null) {
            exception = new UnresolvedForwardReference(getParser(), "Unresolved forward references for: ");
        }
        Object key = roid.getKey().key;
        for (Iterator<Referring> iterator = roid.referringProperties(); iterator.hasNext(); ) {
            Referring referring = iterator.next();
            exception.addUnresolvedId(key, referring.getBeanType(), referring.getLocation());
        }
    }
    if (exception != null) {
        throw exception;
    }
}
Also used : ReadableObjectId(com.fasterxml.jackson.databind.deser.impl.ReadableObjectId) Referring(com.fasterxml.jackson.databind.deser.impl.ReadableObjectId.Referring) IdKey(com.fasterxml.jackson.annotation.ObjectIdGenerator.IdKey)

Aggregations

IdKey (com.fasterxml.jackson.annotation.ObjectIdGenerator.IdKey)1 ReadableObjectId (com.fasterxml.jackson.databind.deser.impl.ReadableObjectId)1 Referring (com.fasterxml.jackson.databind.deser.impl.ReadableObjectId.Referring)1