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 private
TimerSupport()
Constructor. -
Method Summary
Modifier and Type Method Description static String
getTimerName(Object obj)
Produce the name which should be used for aTimer
owned by the specified object.static String
getTimerName(Object obj, String additionalData)
Produce the name which should be used for aTimer
owned by the specified object.static String
getTimerName(String baseName, String additionalData)
Produce the name for aTimer
based on the specified base name.private static String
uncheckedGetTimerName(String baseName, String additionalData)
Unchecked version ofgetTimerName(String, String)
that assumes base name is non-null.
-
Constructor Details
-
TimerSupport
private TimerSupport()Constructor.
-
-
Method Details
-
getTimerName
Produce the name which should be used for aTimer
owned 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 aTimer
owned 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 aTimer
based 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
-