com.fasterxml.jackson.annotation
Class ObjectIdGenerators.IntSequenceGenerator

java.lang.Object
  extended by com.fasterxml.jackson.annotation.ObjectIdGenerator<T>
      extended by com.fasterxml.jackson.annotation.ObjectIdGenerators.IntSequenceGenerator
All Implemented Interfaces:
Serializable
Enclosing class:
ObjectIdGenerators

public static final class ObjectIdGenerators.IntSequenceGenerator
extends ObjectIdGenerator<T>

Simple sequence-number based generator, which uses basic Java ints (starting with value 1) as Object Identifiers.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.fasterxml.jackson.annotation.ObjectIdGenerator
ObjectIdGenerator.IdKey
 
Field Summary
protected  int _nextValue
           
 
Constructor Summary
ObjectIdGenerators.IntSequenceGenerator()
           
ObjectIdGenerators.IntSequenceGenerator(Class<?> scope, int fv)
           
 
Method Summary
 ObjectIdGenerator<Integer> forScope(Class<?> scope)
          Factory method to create a blueprint instance for specified scope.
 Integer generateId(Object forPojo)
          Method used for generating a new Object Identifier to serialize for given POJO.
protected  int initialValue()
           
 ObjectIdGenerator.IdKey key(Object key)
          Method for constructing key to use for ObjectId-to-POJO maps.
 ObjectIdGenerator<Integer> newForSerialization(Object context)
          Factory method called to create a new instance to use for serialization: needed since generators may have state (next id to produce).
 
Methods inherited from class com.fasterxml.jackson.annotation.ObjectIdGenerator
isValidReferencePropertyName, maySerializeAsObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_nextValue

protected transient int _nextValue
Constructor Detail

ObjectIdGenerators.IntSequenceGenerator

public ObjectIdGenerators.IntSequenceGenerator()

ObjectIdGenerators.IntSequenceGenerator

public ObjectIdGenerators.IntSequenceGenerator(Class<?> scope,
                                               int fv)
Method Detail

initialValue

protected int initialValue()

forScope

public ObjectIdGenerator<Integer> forScope(Class<?> scope)
Description copied from class: ObjectIdGenerator
Factory method to create a blueprint instance for specified scope. Generators that do not use scope may return 'this'.

Specified by:
forScope in class ObjectIdGenerator<Integer>

newForSerialization

public ObjectIdGenerator<Integer> newForSerialization(Object context)
Description copied from class: ObjectIdGenerator
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.

Specified by:
newForSerialization in class ObjectIdGenerator<Integer>
Parameters:
context - 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.

key

public ObjectIdGenerator.IdKey key(Object key)
Description copied from class: ObjectIdGenerator
Method for constructing key to use for ObjectId-to-POJO maps.

Specified by:
key in class ObjectIdGenerator<Integer>

generateId

public Integer generateId(Object forPojo)
Description copied from class: ObjectIdGenerator
Method used for generating a new Object Identifier to serialize for given POJO.

Parameters:
forPojo - POJO for which identifier is needed
Returns:
Object Identifier to use.


Copyright © 2008–2016 FasterXML. All rights reserved.