Package net.solarnetwork.central.domain
Class KeyTypePK
java.lang.Object
net.solarnetwork.central.domain.BasePK
net.solarnetwork.central.domain.KeyTypePK
- All Implemented Interfaces:
Serializable,Cloneable,Comparable<KeyTypePK>
Primary key based on a key/type string tuple.
- Since:
- 2.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintCompare twoKeyTypePKobjects.booleangetKey()Get the key.getType()Get the type.inthashCode()static KeyTypePKCreate a new key instance.protected voidPopulate a string builder with an ID value.protected voidPopulate a string builder with a friendly string value.
-
Constructor Details
-
KeyTypePK
Constructor.- Parameters:
key- the keytype- the type- Throws:
IllegalArgumentException- if any argument is null
-
-
Method Details
-
keyType
Create a new key instance.- Parameters:
key- the keytype- the type- Returns:
- the key
- Throws:
IllegalArgumentException- if any argument is null
-
populateIdValue
Description copied from class:BasePKPopulate a string builder with an ID value.This method is called from
BasePK.getId().- Specified by:
populateIdValuein classBasePK- Parameters:
buf- the buffer to populate
-
populateStringValue
Description copied from class:BasePKPopulate a string builder with a friendly string value.This method is called from
BasePK.toString(). The buffer will be initially empty when invoked.- Specified by:
populateStringValuein classBasePK- Parameters:
buf- the buffer to populate
-
hashCode
public int hashCode() -
equals
-
compareTo
Compare twoKeyTypePKobjects.Keys are ordered based on:
- key
- type
- Specified by:
compareToin interfaceComparable<KeyTypePK>- Parameters:
o- the object to compare to- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
-
getKey
Get the key.- Returns:
- the key
-
getType
Get the type.- Returns:
- the type
-