Package com.peterphi.std.types
Class Id
java.lang.Object
com.peterphi.std.types.Id
- All Implemented Interfaces:
Serializable
,Comparable<Id>
- Direct Known Subclasses:
SimpleId
An abstract base type for a case-sensitive identifier
All implementations must directly extend this type (ie. all people who extend this type should mark their implementation as final)
It is not permitted to add any additional fields to an Id field: the sole benefit of extending an Id type is to provide clarity to what kind of Id something is
An id is never permitted to be null, nor may it be an empty String
All implementations must directly extend this type (ie. all people who extend this type should mark their implementation as final)
It is not permitted to add any additional fields to an Id field: the sole benefit of extending an Id type is to provide clarity to what kind of Id something is
An id is never permitted to be null, nor may it be an empty String
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionfinal String
The internal value of this id; while public, this should only be required very rarelystatic final boolean
If true the constructor for Id will verify that all Ids comply with the -
Constructor Summary
-
Method Summary
-
Field Details
-
SANITY_CHECK
public static final boolean SANITY_CHECKIf true the constructor for Id will verify that all Ids comply with the- See Also:
-
id
The internal value of this id; while public, this should only be required very rarely
-
-
Constructor Details
-
Id
Constructs a new id- Parameters:
id
- the id value to use (may not be null)
-
-
Method Details
-
toString
-
equals
-
compareTo
Compares another Id to this id. Two ids are only comparable if they have the exact same type: if their types are incompatible then a ClassCastException will be thrown
If the types are comparable then the result is a case-sensitive comparison of the underlying id valued- Specified by:
compareTo
in interfaceComparable<Id>
- See Also:
-
hashCode
public final int hashCode()
-