Package org.dellroad.stuff.validation
Interface Uniquifier<T>
- Type Parameters:
T
- the type of object being validated
- All Known Implementing Classes:
DefaultUniquifier
public interface Uniquifier<T>
Converts values into some other object that has the desired uniqueness.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiongetUniqued
(T value) Get an object representing the unique value of the given instance.
-
Method Details
-
getUniqued
Get an object representing the unique value of the given instance. In other words, if and only two values are "the same", this method should return object(s) that match (according toequals()
andObject.hashCode()
).This method may return a value of
null
to indicate thatvalue
does not in fact need to be unique.- Parameters:
value
- the value to be uniquified- Returns:
- unique representative, or
null
to exceptvalue
from the uniqueness requirement - Throws:
ClassCastException
- ifvalue
is not of a supported type
-