Class ShortNames

java.lang.Object
it.tidalwave.util.ShortNames

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

    • ShortNames

      public ShortNames()
  • Method Details

    • shortName

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

      @Nonnull public static String shortName(@Nonnull 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 String shortNames(@Nonnull Iterable<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 String shortId(@Nullable 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 String shortIds(@Nonnull Iterable<?> objects)
      Return the short names for some objects.
      Parameters:
      objects - the objects
      Returns:
      the short names
    • shortIds

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