Class ShortNames


  • public class ShortNames
    extends java.lang.Object
    A utility that returns short qualified names for class literals and objects.
    Since:
    3.2-ALPHA-17
    Author:
    Fabrizio Giudici
    • Constructor Summary

      Constructors 
      Constructor Description
      ShortNames()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String shortId​(java.lang.Object object)
      Return the short name for an object.
      static java.lang.String shortIds​(java.lang.Iterable<?> objects)
      Return the short names for some objects.
      static java.lang.String shortIds​(java.lang.Object... objects)
      Return the short names for some objects.
      static java.lang.String shortName​(java.lang.Class<?> clazz)
      Returns the short name for a class literal.
      static java.lang.String shortName​(java.lang.Class<?> clazz, boolean withInterfaces)
      Returns the short name for a class literal, eventually adding interface names (but not those in the java.* package).
      static java.lang.String shortNames​(java.lang.Iterable<java.lang.Class<?>> classes)
      Returns the short name for class literals, eventually adding interface names (but not those in the java.* package).
      • Methods inherited from class java.lang.Object

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

      • ShortNames

        public ShortNames()
    • Method Detail

      • shortName

        @Nonnull
        public static java.lang.String shortName​(@Nonnull
                                                 java.lang.Class<?> clazz)
        Returns the short name for a class literal.
        Parameters:
        clazz - the class
        Returns:
        the short name
      • shortName

        @Nonnull
        public static java.lang.String shortName​(@Nonnull
                                                 java.lang.Class<?> clazz,
                                                 boolean withInterfaces)
        Returns the short name for a class literal, eventually adding interface names (but not those in the java.* package).
        Parameters:
        clazz - the class
        withInterfaces - whether the interfaces must be listed
        Returns:
        the short name
      • shortNames

        @Nonnull
        public static java.lang.String shortNames​(@Nonnull
                                                  java.lang.Iterable<java.lang.Class<?>> classes)
        Returns the short name for class literals, eventually adding interface names (but not those in the java.* package).
        Parameters:
        classes - the classes
        Returns:
        the short names
      • shortId

        @Nonnull
        public static java.lang.String shortId​(@Nullable
                                               java.lang.Object object)
        Return the short name for an object. If the object contains a method named getId(), the id is part of the result.
        Parameters:
        object - the object
        Returns:
        the short name
      • shortIds

        @Nonnull
        public static java.lang.String shortIds​(@Nonnull
                                                java.lang.Iterable<?> objects)
        Return the short names for some objects.
        Parameters:
        objects - the objects
        Returns:
        the short names
      • shortIds

        @Nonnull
        public static java.lang.String shortIds​(@Nonnull
                                                java.lang.Object... objects)
        Return the short names for some objects.
        Parameters:
        objects - the objects
        Returns:
        the short names