Package com.globalmentor.model
Class DefaultComparableNamed<N extends Comparable<N>>
java.lang.Object
com.globalmentor.model.DefaultNamed<N>
com.globalmentor.model.DefaultComparableNamed<N>
- All Implemented Interfaces:
Named<N>
,Comparable<Named<N>>
- Direct Known Subclasses:
DefaultComparableIDNamed
,Host
public class DefaultComparableNamed<N extends Comparable<N>>
extends DefaultNamed<N>
implements Comparable<Named<N>>
A default implementation of a named object comparable by name. This implementation does not allow a
null
name.- Author:
- Garret Wilson
-
Constructor Summary
-
Method Summary
Methods inherited from class com.globalmentor.model.DefaultNamed
equals, getName, hashCode, toString
-
Constructor Details
-
DefaultComparableNamed
Constructor specifying the name.- Parameters:
newName
- The object's new name.- Throws:
NullPointerException
- if the given name isnull
;
-
-
Method Details
-
compareTo
Compares this object to another object. This method determines order based upon the name.- Specified by:
compareTo
in interfaceComparable<N extends Comparable<N>>
- Parameters:
namedObject
- The object with which to compare this object.- Returns:
- A negative integer, zero, or a positive integer as this name is less than, equal to, or greater than the name of the specified object, respectively.
- Throws:
ClassCastException
- See Also:
-