Class DeprecationSupport
- java.lang.Object
-
- net.shibboleth.utilities.java.support.primitive.DeprecationSupport
-
public final class DeprecationSupport extends Object
Helper methods for reporting usage of deprecated features.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDeprecationSupport.ObjectTypeType of object, setting, feature, etc.
-
Field Summary
Fields Modifier and Type Field Description private static org.slf4j.LoggerLOGClass logger.static StringLOG_CATEGORYLog category name for warnings.private static Set<String>WARNED_SETTracks issued warnings.
-
Constructor Summary
Constructors Modifier Constructor Description privateDeprecationSupport()Constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclearWarningState()Clear the previously warned state.static voidwarn(DeprecationSupport.ObjectType type, String name, String context, String replacement)Emit a deprecation warning for an object or feature of the system.static voidwarnOnce(DeprecationSupport.ObjectType type, String name, String context, String replacement)Emit a deprecation warning for an object or feature of the system but limit to a single warning for the life of the process or until state is cleared.
-
-
-
Field Detail
-
LOG_CATEGORY
@Nonnull @NotEmpty public static final String LOG_CATEGORY
Log category name for warnings.- See Also:
- Constant Field Values
-
LOG
@Nonnull private static final org.slf4j.Logger LOG
Class logger.
-
WARNED_SET
@Nonnull @NonnullElements private static final Set<String> WARNED_SET
Tracks issued warnings.
-
-
Method Detail
-
warn
public static void warn(@Nonnull DeprecationSupport.ObjectType type, @Nonnull @NotEmpty String name, @Nullable String context, @Nullable String replacement)Emit a deprecation warning for an object or feature of the system.- Parameters:
type- type of object or featurename- name of object or featurecontext- surrounding context for deprecation warningreplacement- the replacement for the deprecated feature
-
warnOnce
public static void warnOnce(@Nonnull DeprecationSupport.ObjectType type, @Nonnull @NotEmpty String name, @Nullable String context, @Nullable String replacement)Emit a deprecation warning for an object or feature of the system but limit to a single warning for the life of the process or until state is cleared.- Parameters:
type- type of object or featurename- name of object or featurecontext- surrounding context for deprecation warningreplacement- the replacement for the deprecated feature
-
clearWarningState
public static void clearWarningState()
Clear the previously warned state.
-
-