Package net.solarnetwork.central.domain
Interface CompositeKey2<K1,K2>
- Type Parameters:
K1- the first key component typeK2- the second key component type
- All Superinterfaces:
CompositeKey
- All Known Implementing Classes:
LongIntegerCompositePK,LongStringCompositePK,UserLongCompositePK,UserStringCompositePK,UserUuidPK
API for a composite key with two components.
-
Method Summary
Modifier and TypeMethodDescriptiondefault ObjectkeyComponent(int index) Get the key component for a specific index.Get the first key component.Get the second key component.default booleankeyComponentIsAssigned(int index) Test if a given key component is assigned a value or not.default intGet the number of components in the composite key.Methods inherited from interface net.solarnetwork.central.domain.CompositeKey
createKey, keyComponentValue
-
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:CompositeKeyGet the number of components in the composite key.- Specified by:
keyComponentLengthin interfaceCompositeKey- Returns:
- the number of components
-
keyComponentIsAssigned
default boolean keyComponentIsAssigned(int index) Description copied from interface:CompositeKeyTest 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:
keyComponentIsAssignedin interfaceCompositeKey- 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
Description copied from interface:CompositeKeyGet the key component for a specific index.- Specified by:
keyComponentin interfaceCompositeKey- 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
-