Class KeysetHandle.Builder.Entry

  • Enclosing class:
    KeysetHandle.Builder

    public static final class KeysetHandle.Builder.Entry
    extends java.lang.Object
    One entry, representing a single key, in a Keyset.Builder.

    This is the analogue of Keyset.Entry for a builder.

    Users will have to ensure that each entry has an ID, and one entry is a primary. See KeysetHandle.Builder.build() for details).

    • Method Detail

      • makePrimary

        @CanIgnoreReturnValue
        public KeysetHandle.Builder.Entry makePrimary()
        Marks that this entry is the primary key.

        Other entries in the same keyset will be marked as non-primary if this Entry has already been added to a builder, otherwise they will marked as non-primary once this entry is added to a builder.

      • isPrimary

        public boolean isPrimary()
        Returns whether this entry has been marked as a primary.
      • getStatus

        public KeyStatus getStatus()
        Returns the status of this entry.
      • withFixedId

        @CanIgnoreReturnValue
        public KeysetHandle.Builder.Entry withFixedId​(int id)
        Tells Tink to assign a fixed id when this keyset is built.
      • withRandomId

        @CanIgnoreReturnValue
        public KeysetHandle.Builder.Entry withRandomId()
        Tells Tink to assign an unused uniform random id when this keyset is built.

        Using withRandomId is invalid for an entry with an imported or preexisting key, which has an ID requirement.

        If an entry is marked as withRandomId, all subsequent entries also need to be marked with withRandomId, or else calling build() will fail.