Class Names


  • public final class Names
    extends java.lang.Object
    Utility methods to determine names for objects.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Optional<java.lang.String> nameFromNameMethod​(java.lang.Object object)
      Tries to get the name of an object from one of its methods.
      • Methods inherited from class java.lang.Object

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

      • nameFromNameMethod

        public static final java.util.Optional<java.lang.String> nameFromNameMethod​(java.lang.Object object)
        Tries to get the name of an object from one of its methods. Only methods which return strings and have no parameters are considered. the search is done in the following order:
        1. "name()"
        2. "getName()"
        Parameters:
        object - the object for which to retrieve the name
        Returns:
        the name as derived from a name method, if available.