Package it.tidalwave.util
Class ShortNames
- java.lang.Object
-
- it.tidalwave.util.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).
-
-
-
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 classwithInterfaces
- 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 namedgetId()
, 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
-
-