Class GenerationId

    • Field Detail

      • NO_GENERATION_ID

        public static final GenerationId NO_GENERATION_ID
        To be used when the generation id is not set.
      • EMPTY_BACKEND_GENERATION_ID

        public static final GenerationId EMPTY_BACKEND_GENERATION_ID
        This is the generation id for an empty backend.

        It corresponds to a backend entry count of zero, i.e. we encode 0 in ASCII which gives 48.

      • DUMMY_GENERATION_ID

        public static final GenerationId DUMMY_GENERATION_ID
        TO be used for unit testing.
    • Method Detail

      • valueOf

        public static GenerationId valueOf​(long generationId)
        Returns a generation id object having the provided value.
        Parameters:
        generationId - value of the generation id
        Returns:
        a generation id object made having the provided value
      • valueOf

        public static GenerationId valueOf​(ByteString generationId)
        Returns a generation id object having the provided value encoded as a ByteString.
        Parameters:
        generationId - value of the generation id encoded as a ByteString
        Returns:
        a generation id object made having the provided value encoded as a ByteString
      • longValue

        public long longValue()
        The long value of the generation ID.
        Returns:
        long value of the generation ID
      • isValid

        public boolean isValid()
        Whether this generation id is valid, i.e. positive.
        Returns:
        whether this generation id is valid, i.e. positive
      • isDifferent

        public boolean isDifferent​(GenerationId other)
        Whether this generation id is different to the provided one (and both are valid).
        Parameters:
        other - the generation id to compare against
        Returns:
        whether this generation id is different to the provided one (and both are valid)
      • isSame

        public boolean isSame​(GenerationId other)
        Whether this generation id is the same as the provided one (and none are NO_GENERATION_ID).
        Parameters:
        other - the generation id to compare against
        Returns:
        whether this generation id is the same as the provided one (and none are NO_GENERATION_ID)
      • isEqualToOrNoGenerationId

        public boolean isEqualToOrNoGenerationId​(GenerationId other)
        Whether this generation id is NO_GENERATION_ID) or equal to the provided one.
        Parameters:
        other - the generation id to compare against
        Returns:
        whether this generation id is NO_GENERATION_ID) or equal to the provided one
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object