Class DefaultNamed<N>

  • All Implemented Interfaces:
    Named<N>
    Direct Known Subclasses:
    DefaultComparableNamed, NameValuePair

    public class DefaultNamed<N>
    extends java.lang.Object
    implements Named<N>
    A default implementation of a named object.
    Author:
    Garret Wilson
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultNamed​(N name)
      Constructor specifying the name.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object object)
      Compares the names of two objects if the other object is a Named.
      N getName()  
      int hashCode()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • DefaultNamed

        public DefaultNamed​(N name)
        Constructor specifying the name.
        Parameters:
        name - The object's new name, or null if the object has no name.
    • Method Detail

      • getName

        public N getName()
        Specified by:
        getName in interface Named<N>
        Returns:
        The name of the object, or null if the object has no name.
      • equals

        public boolean equals​(java.lang.Object object)
        Compares the names of two objects if the other object is a Named.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        object - The object with which to compare this named object; should be another Named.
        Returns:
        true if the other object is a named object with the same name.
        See Also:
        getName()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        A hashcode value composed from the name.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        Returns:
        A string representation of this object's name.