Interface CompositeKey2<K1,K2>

Type Parameters:
K1 - the first key component type
K2 - the second key component type
All Superinterfaces:
CompositeKey
All Known Implementing Classes:
LongIntegerCompositePK, LongStringCompositePK, UserLongCompositePK, UserStringCompositePK, UserUuidPK

public interface CompositeKey2<K1,K2> extends CompositeKey
API for a composite key with two components.
  • Method Details

    • keyComponent1

      K1 keyComponent1()
      Get the first key component.
      Returns:
      the first key component
    • keyComponent2

      K2 keyComponent2()
      Get the second key component.
      Returns:
      the second key component
    • keyComponentLength

      default int keyComponentLength()
      Description copied from interface: CompositeKey
      Get the number of components in the composite key.
      Specified by:
      keyComponentLength in interface CompositeKey
      Returns:
      the number of components
    • keyComponentIsAssigned

      default boolean keyComponentIsAssigned(int index)
      Description copied from interface: CompositeKey
      Test if a given key component is assigned a value or not.

      This method is designed to support cases when the key component is generated by an external system (such as a database) but the value is not allowed to be null. In this situation a placeholder value representing "not a value" can be used, and this method should return false if that value has been set on the instance.

      Specified by:
      keyComponentIsAssigned in interface CompositeKey
      Parameters:
      index - the component index to test, starting from 0
      Returns:
      true if the key component's value should be considered "assigned", false otherwise
    • keyComponent

      default Object keyComponent(int index)
      Description copied from interface: CompositeKey
      Get the key component for a specific index.
      Specified by:
      keyComponent in interface CompositeKey
      Parameters:
      index - the index of the key component to get, starting from 0
      Returns:
      the associated key component, or null if the component is not assigned, or the index is out of range