Class LongPrimaryKeyGenerator

java.lang.Object
com.reallifedeveloper.tools.test.database.inmemory.LongPrimaryKeyGenerator
All Implemented Interfaces:
PrimaryKeyGenerator<Long>

public class LongPrimaryKeyGenerator extends Object implements PrimaryKeyGenerator<Long>
A primary key generator that generates a sequence of long integers.
Author:
RealLifeDeveloper
  • Constructor Details

    • LongPrimaryKeyGenerator

      public LongPrimaryKeyGenerator()
  • Method Details

    • nextPrimaryKey

      public Long nextPrimaryKey(Long previousMax)
      Gives the next primary key given the previous maximum primary key value.
      Specified by:
      nextPrimaryKey in interface PrimaryKeyGenerator<Long>
      Parameters:
      previousMax - the previous maximum primary key value of any saved entity, or null to start from scratch
      Returns:
      the next primary key