Class Labels


  • public class Labels
    extends java.lang.Object
    Utilities for working with human-readable representations of objects.
    Author:
    Garret Wilson
    • Constructor Summary

      Constructors 
      Constructor Description
      Labels()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.CharSequence getLabel​(java.lang.Object object)
      Determines a human-readable representation of a given object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Labels

        public Labels()
    • Method Detail

      • getLabel

        public static java.lang.CharSequence getLabel​(java.lang.Object object)
        Determines a human-readable representation of a given object.

        If the object is Labeled, Labeled.getLabel() is returned. Otherwise, if the object is a CharSequence it is returned unchanged; if not, Object.toString() is returned.

        Parameters:
        object - The object for which a label should be determined.
        Returns:
        A label meant for human consumption identifying the object.
        Throws:
        java.lang.NullPointerException - if the given object is null.
        See Also:
        Labeled.getLabel()