Class RxJavaProtocolValidator
- java.lang.Object
-
- hu.akarnokd.rxjava3.debug.validator.RxJavaProtocolValidator
-
public final class RxJavaProtocolValidator extends java.lang.ObjectInstalls assembly hooks that validate the Reactive-Streams and derived protocols are honored.- Since:
- 0.17.4
- See Also:
setOnViolationHandler(PlainConsumer),enable()
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voiddisable()Disables the validation hooks be resetting the assembly hooks to none.static voidenable()Enable the protocol violation hooks.static SavedHooksenableAndChain()Enable the protocol violation hooks by chaining it before any existing hook.static @Nullable PlainConsumer<ProtocolNonConformanceException>getOnViolationHandler()Returns the current custom violation callback handler.static booleanisEnabled()Returns true if the validation hooks have been installed.static voidsetOnViolationHandler(@Nullable PlainConsumer<ProtocolNonConformanceException> handler)Set a custom violation callback handler.
-
-
-
Method Detail
-
enable
public static void enable()
Enable the protocol violation hooks.- See Also:
enableAndChain(),disable()
-
enableAndChain
public static SavedHooks enableAndChain()
Enable the protocol violation hooks by chaining it before any existing hook.- Returns:
- the SavedHooks instance that allows restoring the previous assembly hook handlers overridden by this method
- See Also:
enable()
-
disable
public static void disable()
Disables the validation hooks be resetting the assembly hooks to none.
-
isEnabled
public static boolean isEnabled()
Returns true if the validation hooks have been installed.- Returns:
- true if the validation hooks have been installed
-
setOnViolationHandler
public static void setOnViolationHandler(@Nullable @Nullable PlainConsumer<ProtocolNonConformanceException> handler)
Set a custom violation callback handler.Call this method before enabling the validation hooks via
enable().Calling with
nullrestores the default handler which forwards the exception to the globalRxJavaPlugins.onError(Throwable)handler.- Parameters:
handler- the handler that will receive theProtocolNonConformanceExceptionviolation exceptions
-
getOnViolationHandler
@Nullable public static @Nullable PlainConsumer<ProtocolNonConformanceException> getOnViolationHandler()
Returns the current custom violation callback handler.- Returns:
- the current custom violation callback handler or null if not set
-
-