All Implemented Interfaces:
Serializable

public class PropertyBasedObjectIdGenerator extends ObjectIdGenerators.PropertyGenerator
See Also:
  • Field Details

    • _scope

      protected final Class<?> _scope
  • Constructor Details

    • PropertyBasedObjectIdGenerator

      public PropertyBasedObjectIdGenerator(Class<?> scope)
  • Method Details

    • generateId

      public Object 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.
    • forScope

      public ObjectIdGenerator<Object> 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<Object>
    • newForSerialization

      public ObjectIdGenerator<Object> 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<Object>
      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<Object>
    • getScope

      public final Class<?> getScope()
      Specified by:
      getScope in class ObjectIdGenerator<T>
    • canUseFor

      public boolean canUseFor(ObjectIdGenerator<?> gen)
      Description copied from class: ObjectIdGenerator
      Method called to check whether this generator instance can be used for Object Ids of specific generator type and scope; determination is based by passing a configured "blueprint" (prototype) instance; from which the actual instances are created (using ObjectIdGenerator.newForSerialization(java.lang.Object)).
      Specified by:
      canUseFor in class ObjectIdGenerator<T>
      Returns:
      True if this instance can be used as-is; false if not