Class DeprecationSupport


  • public final class DeprecationSupport
    extends Object
    Helper methods for reporting usage of deprecated features.
    • Field Detail

      • LOG

        @Nonnull
        private static final org.slf4j.Logger LOG
        Class logger.
    • Constructor Detail

      • DeprecationSupport

        private DeprecationSupport()
        Constructor.
    • 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 feature
        name - name of object or feature
        context - surrounding context for deprecation warning
        replacement - 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 feature
        name - name of object or feature
        context - surrounding context for deprecation warning
        replacement - the replacement for the deprecated feature
      • clearWarningState

        public static void clearWarningState()
        Clear the previously warned state.