Class IntegerPrimaryKeyGenerator

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

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

    • IntegerPrimaryKeyGenerator

      public IntegerPrimaryKeyGenerator()
  • Method Details

    • nextPrimaryKey

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