Class ObjectIdGenerators.IntSequenceGenerator

  • All Implemented Interfaces:
    Enclosing class:

    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
    • Constructor Detail

      • IntSequenceGenerator

        public IntSequenceGenerator()
      • IntSequenceGenerator

        public IntSequenceGenerator​(java.lang.Class<?> scope,
                                    int fv)
    • Method Detail

      • forScope

        public ObjectIdGenerator<java.lang.Integer> forScope​(java.lang.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<java.lang.Integer>
      • newForSerialization

        public ObjectIdGenerator<java.lang.Integer> newForSerialization​(java.lang.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<java.lang.Integer>
        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.
      • generateId

        public java.lang.Integer generateId​(java.lang.Object forPojo)
        Description copied from class: ObjectIdGenerator
        Method used for generating a new Object Identifier to serialize for given POJO.
        forPojo - POJO for which identifier is needed
        Object Identifier to use.