Package com.globalmentor.model
Class DefaultComparableNamed<N extends java.lang.Comparable<N>>
- java.lang.Object
-
- com.globalmentor.model.DefaultNamed<N>
-
- com.globalmentor.model.DefaultComparableNamed<N>
-
- Direct Known Subclasses:
DefaultComparableIDNamed
,Host
public class DefaultComparableNamed<N extends java.lang.Comparable<N>> extends DefaultNamed<N> implements java.lang.Comparable<Named<N>>
A default implementation of a named object comparable by name. This implementation does not allow anull
name.- Author:
- Garret Wilson
-
-
Constructor Summary
Constructors Constructor Description DefaultComparableNamed(N newName)
Constructor specifying the name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Named<N> namedObject)
Compares this object to another object.-
Methods inherited from class com.globalmentor.model.DefaultNamed
equals, getName, hashCode, toString
-
-
-
-
Constructor Detail
-
DefaultComparableNamed
public DefaultComparableNamed(N newName)
Constructor specifying the name.- Parameters:
newName
- The object's new name.- Throws:
java.lang.NullPointerException
- if the given name isnull
;
-
-
Method Detail
-
compareTo
public int compareTo(Named<N> namedObject) throws java.lang.ClassCastException
Compares this object to another object. This method determines order based upon the name.- Specified by:
compareTo
in interfacejava.lang.Comparable<N extends java.lang.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:
java.lang.ClassCastException
- See Also:
DefaultNamed.getName()
-
-