Class TypeSwitch.Default<T>

java.lang.Object
com.hivemq.client.util.TypeSwitch.Default<T>
All Implemented Interfaces:
TypeSwitch<T>
Enclosing interface:
TypeSwitch<T>

public static class TypeSwitch.Default<T> extends Object implements TypeSwitch<T>
  • Method Details

    • is

      @NotNull public <I extends T> @NotNull TypeSwitch<T> is(@NotNull @NotNull Class<I> type, @NotNull @NotNull Consumer<I> consumer)
      Description copied from interface: TypeSwitch
      Checks if the object that is switched over is of a given type and if so executes a callback.

      If the type matches the returned TypeSwitch will not match any further type.

      Specified by:
      is in interface TypeSwitch<T>
      Type Parameters:
      I - the type to check
      Parameters:
      type - the class of the type to check.
      consumer - the callback to execute if the type matches.
      Returns:
      the TypeSwitch object.