Class TimerSupport
- java.lang.Object
-
- net.shibboleth.utilities.java.support.primitive.TimerSupport
-
public final class TimerSupport extends Object
Timer utility methods.
-
-
Constructor Summary
Constructors Modifier Constructor Description privateTimerSupport()Constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetTimerName(Object obj)Produce the name which should be used for aTimerowned by the specified object.static StringgetTimerName(Object obj, String additionalData)Produce the name which should be used for aTimerowned by the specified object.static StringgetTimerName(String baseName, String additionalData)Produce the name for aTimerbased on the specified base name.private static StringuncheckedGetTimerName(String baseName, String additionalData)Unchecked version ofgetTimerName(String, String)that assumes base name is non-null.
-
-
-
Method Detail
-
getTimerName
@Nonnull @NotEmpty public static String getTimerName(@Nonnull Object obj)
Produce the name which should be used for aTimerowned by the specified object.The base name will be constructed as follows:
- if target is instance of
IdentifiedComponent, useIdentifiedComponent.getId()if non-empty - use
Object.toString()if non-empty - use serialized class name
- Parameters:
obj- the target object instance to evaluate- Returns:
- an appropriate name for a Timer owned by the specified object
- if target is instance of
-
getTimerName
@Nonnull @NotEmpty public static String getTimerName(@Nonnull Object obj, @Nullable String additionalData)
Produce the name which should be used for aTimerowned by the specified object.The base name will be constructed as follows:
- if target is instance of
IdentifiedComponent, useIdentifiedComponent.getId()if non-empty - use
Object.toString()if non-empty - use serialized class name
- Parameters:
obj- the target object instance to evaluateadditionalData- additional qualifying data to include in the name- Returns:
- an appropriate name for a Timer owned by the specified object
- if target is instance of
-
getTimerName
@Nonnull @NotEmpty public static String getTimerName(@Nonnull String baseName, @Nullable String additionalData)
Produce the name for aTimerbased on the specified base name.- Parameters:
baseName- the base name of TimeradditionalData- additional qualifying data to include in the name- Returns:
- an appropriate name for a Timer based on the specified base name
-
uncheckedGetTimerName
@Nonnull @NotEmpty private static String uncheckedGetTimerName(@Nonnull String baseName, @Nullable String additionalData)
Unchecked version ofgetTimerName(String, String)that assumes base name is non-null.- Parameters:
baseName- the base name of TimeradditionalData- additional qualifying data to include in the name- Returns:
- an appropriate name for a Timer based on the specified base name
-
-