Package net.solarnetwork.domain
Interface Identity<PK>
- Type Parameters:
PK- the primary data type that uniquely identifies the object
- All Superinterfaces:
Comparable<PK>
- All Known Subinterfaces:
ConfigurableLocalizedServiceInfo,CopyingIdentity<K,,C> Entity<K>,LocalizedServiceInfo,TemplateRenderer
- All Known Implementing Classes:
BaseLocalizedServiceInfoProvider,BaseSettingsSpecifierLocalizedServiceInfoProvider,BasicConfigurableLocalizedServiceInfo,BasicEntity,BasicIdentity,BasicIdentity,BasicLocalizedServiceInfo,BasicLongEntity,BasicStringEntity,BasicUuidEntity,GeneralDatum
Common API for identity information in SolarNetwork participating services.
- Since:
- 1.43
- Version:
- 1.2
- Author:
- matt
-
Method Summary
Modifier and TypeMethodDescriptiongetId()Get the primary identifier of the objectdefault booleanhasId()Test if this object has a valid identifier.static <T extends Identity<PK>,PK extends Comparable<PK>>
Comparator<T>Sort instances by their ID values.Methods inherited from interface java.lang.Comparable
compareTo
-
Method Details
-
getId
PK getId()Get the primary identifier of the object- Returns:
- the primary identifier
-
hasId
default boolean hasId()Test if this object has a valid identifier.This method must only return true if the object returned from
getId()is a valid identifier for objects of this type.This implementation simply tests if
getId()is not null. Extending classes, such as those with composite keys where nested properties must be defined for the key to be valid, can override this implementation as needed.- Returns:
- true if this object has a valid identifier
- Since:
- 1.1
-
sortByIdentity
Sort instances by their ID values.- Type Parameters:
T- theIdentitytypePK- theIdentityID type- Returns:
- the comparator
- Since:
- 1.2
-