Class DefaultIDNamed<I,​N>

  • All Implemented Interfaces:
    IDed<I>, Named<N>
    Direct Known Subclasses:
    DefaultIDNameDescriptioned

    public class DefaultIDNamed<I,​N>
    extends DefaultIDed<I>
    implements Named<N>
    A convenience class for storing an ID and a name. This class is useful to serve as a base class to other classes that are identified by an ID and a name.
    Author:
    Garret Wilson
    • Constructor Detail

      • DefaultIDNamed

        public DefaultIDNamed​(I id,
                              N name)
        Constructor specifying the ID and name.
        Parameters:
        id - The ID of the object, or null if hte object shoudl have no name.
        name - The name of the object.
    • Method Detail

      • getName

        public N getName()
        Specified by:
        getName in interface Named<I>
        Returns:
        The name of the object.
      • setName

        protected void setName​(N name)
        Sets the name of the object.
        Parameters:
        name - The new name of the object, or null if the object should have no name.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class DefaultIDed<I>
        Returns:
        A string representation of this object in the format "objectinfo: [ID] name".