java.lang.Object
tools.jackson.databind.deser.ReadableObjectId
Simple value container for containing information about single Object Id
during deserialization
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Objectprotected booleanFlag set whentryReplaceBoundItem(java.lang.Object, java.lang.Object)is called, indicating that_itemhas been replaced and should not be refreshed from resolver.protected final ObjectIdGenerator.IdKeyprotected booleanFlag set by callers (e.g., builder-based id property) to indicate that the bound item is a transient delegate that may later be rebuilt viaDeserializationContext.updateObjectId(java.lang.Object, java.lang.Object); only then is it worth retaining resolved Referrings fornotifyReferringsOfRebind(java.lang.Object, java.lang.Object).protected LinkedList<ReadableObjectId.Referring>protected List<ReadableObjectId.Referring>Referring properties that have already been resolved viabindItem(tools.jackson.databind.DeserializationContext, java.lang.Object).protected ObjectIdResolver -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappendReferring(ReadableObjectId.Referring currentReferring) voidbindItem(DeserializationContext ctxt, Object ob) Method called to assign actual POJO to which ObjectId refers to: will also handle referring properties, if any, by assigning POJO.getKey()Allow access to the resolver in case anybody wants to use it directly, for examples fromDeserializationContextExt.tryToResolveUnresolvedObjectId(tools.jackson.databind.deser.ReadableObjectId).booleanvoidMark this entry as potentially rebindable (e.g., bound to a Builder instance whosefinishBuildwill later triggerDeserializationContext.updateObjectId(java.lang.Object, java.lang.Object)).voidnotifyReferringsOfRebind(Object oldItem, Object newItem) Method called aftertryReplaceBoundItem(java.lang.Object, java.lang.Object)to notify previously-resolvedReadableObjectId.Referringinstances that the bound item has been replaced (e.g., builder → built object).resolve()voidsetResolver(ObjectIdResolver resolver) toString()booleantryReplaceBoundItem(Object delegate, Object newItem) Method called to try to replace the bound item after a delegating@JsonCreatorhas converted the intermediate delegate object into the final bean.booleanMethod called byDeserializationContextat the end of deserialization if this Object Id was not resolved during normal processing.
-
Field Details
-
_item
- Since:
- 2.8 (with this name, formerly `public Object item`)
-
_itemReplaced
protected boolean _itemReplacedFlag set whentryReplaceBoundItem(java.lang.Object, java.lang.Object)is called, indicating that_itemhas been replaced and should not be refreshed from resolver.- Since:
- 3.2
-
_key
-
_referringProperties
-
_resolvedReferringProperties
Referring properties that have already been resolved viabindItem(tools.jackson.databind.DeserializationContext, java.lang.Object). Kept alive so thatnotifyReferringsOfRebind(java.lang.Object, java.lang.Object)can propagate builder-to-built-object replacements (e.g., afterfinishBuild). Only populated when_mayRebindis set, since plain (non-Builder) deserialization never callsupdateObjectIdand would otherwise retain Referrings as dead memory.- Since:
- 3.2
-
_mayRebind
protected boolean _mayRebindFlag set by callers (e.g., builder-based id property) to indicate that the bound item is a transient delegate that may later be rebuilt viaDeserializationContext.updateObjectId(java.lang.Object, java.lang.Object); only then is it worth retaining resolved Referrings fornotifyReferringsOfRebind(java.lang.Object, java.lang.Object).- Since:
- 3.2
-
_resolver
-
-
Constructor Details
-
ReadableObjectId
-
-
Method Details
-
setResolver
-
getKey
-
appendReferring
-
markMayRebind
public void markMayRebind()Mark this entry as potentially rebindable (e.g., bound to a Builder instance whosefinishBuildwill later triggerDeserializationContext.updateObjectId(java.lang.Object, java.lang.Object)). Enables retention of resolved Referrings sonotifyReferringsOfRebind(java.lang.Object, java.lang.Object)can fire.- Since:
- 3.2
-
bindItem
Method called to assign actual POJO to which ObjectId refers to: will also handle referring properties, if any, by assigning POJO.- Throws:
JacksonException
-
tryReplaceBoundItem
Method called to try to replace the bound item after a delegating@JsonCreatorhas converted the intermediate delegate object into the final bean. UnlikebindItem(tools.jackson.databind.DeserializationContext, java.lang.Object), this method does not go through theObjectIdResolver(which would reject re-binding) but instead directly replaces the tracked item.- Parameters:
delegate- The intermediate delegate object to match against current bindingnewItem- The final bean to replace the delegate with- Returns:
trueif this entry was bound todelegateand was replaced;falseif not bound todelegate- Since:
- 3.2
-
notifyReferringsOfRebind
Method called aftertryReplaceBoundItem(java.lang.Object, java.lang.Object)to notify previously-resolvedReadableObjectId.Referringinstances that the bound item has been replaced (e.g., builder → built object). Collection-like Referring implementations should overrideReadableObjectId.Referring.handleItemRebind(java.lang.Object, java.lang.Object)to swap the old item for the new one.- Throws:
JacksonException- Since:
- 3.2
-
resolve
-
hasReferringProperties
public boolean hasReferringProperties() -
referringProperties
-
tryToResolveUnresolved
Method called byDeserializationContextat the end of deserialization if this Object Id was not resolved during normal processing. Call is made to allow custom implementations to use alternative resolution strategies; currently the only way to make use of this functionality is by sub-classingReadableObjectIdand overriding this method.Default implementation simply returns
falseto indicate that resolution attempt did not succeed.- Returns:
- True, if resolution succeeded (and no error needs to be reported); false to indicate resolution did not succeed.
- Since:
- 2.6
-
getResolver
Allow access to the resolver in case anybody wants to use it directly, for examples fromDeserializationContextExt.tryToResolveUnresolvedObjectId(tools.jackson.databind.deser.ReadableObjectId).- Returns:
- The registered resolver
- Since:
- 2.7
-
toString
-