Top Fields Constructors Methods
com.fasterxml.jackson.databind.ser.impl

public Class PropertyBasedObjectIdGenerator

extends PropertyGenerator
Class Inheritance
Imports
com.fasterxml.jackson.annotation.ObjectIdGenerator, .ObjectIdGenerators, com.fasterxml.jackson.databind.introspect.ObjectIdInfo, com.fasterxml.jackson.databind.ser.*

Field Summary

Modifier and TypeField and Description
protected final BeanPropertyWriter
private static final long

Constructor Summary

AccessConstructor and Description
public
protected

Method Summary

Modifier and TypeMethod and Description
public boolean
canUseFor(ObjectIdGenerator<?> gen)

Overrides com.fasterxml.jackson.annotation.ObjectIdGenerators.Base.canUseFor.

We must override this method, to prevent errors when scopes are the same, but underlying class (on which to access property) is different.

public ObjectIdGenerator<Object>
forScope(Class<?> scope)

Implements abstract com.fasterxml.jackson.annotation.ObjectIdGenerator.forScope.

Factory method to create a blueprint instance for specified scope.

public Object
generateId(Object
POJO for which identifier is needed
forPojo
)

Implements abstract com.fasterxml.jackson.annotation.ObjectIdGenerators.Base.generateId.

Method used for generating a new Object Identifier to serialize for given POJO.

public ObjectIdGenerator.IdKey
key(Object key)

Implements abstract com.fasterxml.jackson.annotation.ObjectIdGenerator.key.

Method for constructing key to use for ObjectId-to-POJO maps.

public ObjectIdGenerator<Object>
newForSerialization(Object
Serialization context object used (of type com.fasterxml.jackson.databind.SerializerProvider); may be needed by more complex generators to access contextual information such as configuration.
context
)

Implements abstract com.fasterxml.jackson.annotation.ObjectIdGenerator.newForSerialization.

Factory method called to create a new instance to use for serialization: needed since generators may have state (next id to produce).

Field Detail

_propertyback to summary
protected final BeanPropertyWriter _property
serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.fasterxml.jackson.annotation.ObjectIdGenerators.PropertyGenerator.serialVersionUID.

Constructor Detail

PropertyBasedObjectIdGeneratorback to summary
public PropertyBasedObjectIdGenerator(ObjectIdInfo oid, BeanPropertyWriter prop)
PropertyBasedObjectIdGeneratorback to summary
protected PropertyBasedObjectIdGenerator(Class<?> scope, BeanPropertyWriter prop)

Method Detail

canUseForback to summary
public boolean canUseFor(ObjectIdGenerator<?> gen)

Overrides com.fasterxml.jackson.annotation.ObjectIdGenerators.Base.canUseFor.

We must override this method, to prevent errors when scopes are the same, but underlying class (on which to access property) is different.

Returns:boolean

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

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

Annotations
@Override
forScopeback to summary
public ObjectIdGenerator<Object> forScope(Class<?> scope)

Implements abstract com.fasterxml.jackson.annotation.ObjectIdGenerator.forScope.

Doc from com.fasterxml.jackson.annotation.ObjectIdGenerator.forScope.

Factory method to create a blueprint instance for specified scope. Generators that do not use scope may return 'this'.

Annotations
@Override
generateIdback to summary
public Object generateId(Object forPojo)

Implements abstract com.fasterxml.jackson.annotation.ObjectIdGenerators.Base.generateId.

Doc from com.fasterxml.jackson.annotation.ObjectIdGenerator.generateId.

Method used for generating a new Object Identifier to serialize for given POJO.

Parameters
forPojo:Object

POJO for which identifier is needed

Returns:Object

Object Identifier to use.

Annotations
@Override
keyback to summary
public ObjectIdGenerator.IdKey key(Object key)

Implements abstract com.fasterxml.jackson.annotation.ObjectIdGenerator.key.

Doc from com.fasterxml.jackson.annotation.ObjectIdGenerator.key.

Method for constructing key to use for ObjectId-to-POJO maps.

Annotations
@Override
newForSerializationback to summary
public ObjectIdGenerator<Object> newForSerialization(Object context)

Implements abstract com.fasterxml.jackson.annotation.ObjectIdGenerator.newForSerialization.

Doc from com.fasterxml.jackson.annotation.ObjectIdGenerator.newForSerialization.

Factory method called to create a new instance to use for serialization: needed since generators may have state (next id to produce).

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

Parameters
context:Object

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

Annotations
@Override