Class MagicWebSocketClientProfile<C>

java.lang.Object
dev.ua.theroer.magicutils.http.MagicWebSocketClientProfile<C>
Type Parameters:
C - config type driving the profile
All Implemented Interfaces:
AutoCloseable

public final class MagicWebSocketClientProfile<C> extends Object implements AutoCloseable
High-level runtime profile for named MagicWebSocketClient instances.
  • Method Details

    • builder

      public static <C> MagicWebSocketClientProfile.Builder<C> builder(MagicRuntime runtime, String name, Class<C> configClass)
      Creates a profile builder.
      Type Parameters:
      C - config type
      Parameters:
      runtime - runtime that owns the client
      name - runtime component name
      configClass - config class driving the client
      Returns:
      builder instance
    • name

      public String name()
      Returns the runtime name of this profile.
      Returns:
      profile name
    • binding

      Returns the underlying runtime binding.
      Returns:
      config binding
    • current

      public Optional<MagicWebSocketClient> current()
      Returns the current client when available.
      Returns:
      optional current client
    • require

      public MagicWebSocketClient require()
      Returns the current client or throws when unavailable.
      Returns:
      current client
    • refresh

      public MagicWebSocketClient refresh()
      Rebuilds the current client from the latest config.
      Returns:
      rebuilt client
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable