Top Description Fields Constructors Methods
com.fasterxml.jackson.annotation

public Class SimpleObjectIdResolver

extends Object
implements ObjectIdResolver
Class Inheritance
All Implemented Interfaces
com.fasterxml.jackson.annotation.ObjectIdResolver
Imports
java.util.HashMap, .Map, com.fasterxml.jackson.annotation.ObjectIdGenerator.IdKey

Simple implementation of ObjectIdResolver
Author
Pascal Gélinas

Field Summary

Modifier and TypeField and Description
protected Map<ObjectIdGenerator.IdKey, Object>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
bindItem(ObjectIdGenerator.IdKey
The Object Identifier
id
,
Object
The POJO associated to that Identifier
ob
)

Implements com.fasterxml.jackson.annotation.ObjectIdResolver.bindItem.

Method called when a POJO is deserialized and has an Object Identifier.

public boolean
canUseFor(ObjectIdResolver resolverType)

Implements com.fasterxml.jackson.annotation.ObjectIdResolver.canUseFor.

Method called to check whether this resolver instance can be used for Object Ids of specific resolver type; determination is based by passing a configured "blueprint" (prototype) instance; from which the actual instances are created (using newForDeserialization).

public ObjectIdResolver
newForDeserialization(Object
Deserialization context object used (of type com.fasterxml.jackson.databind.DeserializationContext) ; may be needed by more complex resolvers to access contextual information such as configuration.
context
)

Implements com.fasterxml.jackson.annotation.ObjectIdResolver.newForDeserialization.

Factory method called to create a new instance to use for deserialization: needed since resolvers may have state (a pool of objects).

public Object
resolveId(ObjectIdGenerator.IdKey
The Object Identifier
id
)

Implements com.fasterxml.jackson.annotation.ObjectIdResolver.resolveId.

Method called when deserialization encounters the given Object Identifier and requires the POJO associated with it.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_itemsback to summary
protected Map<ObjectIdGenerator.IdKey, Object> _items

Constructor Detail

SimpleObjectIdResolverback to summary
public SimpleObjectIdResolver()

Method Detail

bindItemback to summary
public void bindItem(ObjectIdGenerator.IdKey id, Object ob)

Implements com.fasterxml.jackson.annotation.ObjectIdResolver.bindItem.

Doc from com.fasterxml.jackson.annotation.ObjectIdResolver.bindItem.

Method called when a POJO is deserialized and has an Object Identifier. Method exists so that implementation can keep track of existing object in JSON stream that could be useful for further resolution.

Parameters
id:ObjectIdGenerator.IdKey

The Object Identifier

ob:Object

The POJO associated to that Identifier

Annotations
@Override
canUseForback to summary
public boolean canUseFor(ObjectIdResolver resolverType)

Implements com.fasterxml.jackson.annotation.ObjectIdResolver.canUseFor.

Doc from com.fasterxml.jackson.annotation.ObjectIdResolver.canUseFor.

Method called to check whether this resolver instance can be used for Object Ids of specific resolver type; determination is based by passing a configured "blueprint" (prototype) instance; from which the actual instances are created (using newForDeserialization).

Returns:boolean

True if this instance can be used as-is; false if not

Annotations
@Override
newForDeserializationback to summary
public ObjectIdResolver newForDeserialization(Object context)

Implements com.fasterxml.jackson.annotation.ObjectIdResolver.newForDeserialization.

Doc from com.fasterxml.jackson.annotation.ObjectIdResolver.newForDeserialization.

Factory method called to create a new instance to use for deserialization: needed since resolvers may have state (a pool of objects).

Note that actual type of 'context' is com.fasterxml.jackson.databind.DeserializationContext, but can not be declared here as type itself (as well as call to this object) comes from databind package.

Parameters
context:Object

Deserialization context object used (of type com.fasterxml.jackson.databind.DeserializationContext) ; may be needed by more complex resolvers to access contextual information such as configuration.

Annotations
@Override
resolveIdback to summary
public Object resolveId(ObjectIdGenerator.IdKey id)

Implements com.fasterxml.jackson.annotation.ObjectIdResolver.resolveId.

Doc from com.fasterxml.jackson.annotation.ObjectIdResolver.resolveId.

Method called when deserialization encounters the given Object Identifier and requires the POJO associated with it.

Parameters
id:ObjectIdGenerator.IdKey

The Object Identifier

Returns:Object

The POJO, or null if unable to resolve.

Annotations
@Override