Class AutoRegisterHandler<T>

java.lang.Object
de.craftsblock.craftsnet.autoregister.AutoRegisterHandler<T>
Direct Known Subclasses:
BodyAutoRegisterHandler, HandlerAutoRegisterHandler, ListenerAutoRegisterHandler, LogStreamMutatorAutoRegisterHandler, MiddlewareAutoRegisterHandler, ServiceLoaderAutoRegisterHandler, StreamEncoderAutoRegisterHandler, WebRequirementAutoRegisterHandler, WebSocketExtensionAutoRegisterHandler, WebSocketRequirementAutoRegisterHandler, WebSocketTypeDecoderAutoRegisterHandler, WebSocketTypeEncoderAutoRegisterHandler

public abstract class AutoRegisterHandler<T> extends Object
The AutoRegisterHandler class is an abstract base class designed to handle objects during the auto registration process. Each handler is responsible for processing a specific type of object in the auto register system.

Handlers extend this class and implement the handle(Object, AutoRegisterInfo, Object...) method to define how the auto register process should interact with the specific type AutoRegisterHandler. The handler also has access to the CraftsNet instance, which can be used to interact with the main application context.

Since:
3.2.0-SNAPSHOT
  • Field Details

    • craftsNet

      protected final CraftsNet craftsNet
  • Constructor Details

    • AutoRegisterHandler

      public AutoRegisterHandler(CraftsNet craftsNet)
      Constructs an AutoRegisterHandler with the specified CraftsNet instance.
      Parameters:
      craftsNet - The main CraftsNet instance, which provides access to the application's context.
  • Method Details

    • handle

      protected abstract boolean handle(T t, AutoRegisterInfo info, Object... args)
      Handles the provided object AutoRegisterHandler during the auto registration process. This method must be implemented by subclasses to define the specific logic for handling objects of type AutoRegisterHandler.
      Parameters:
      t - The object to handle.
      info - The AutoRegisterInfo which holds more information about the object.
      args - Additional arguments that may be passed during the registration process.
      Returns:
      true if the object was handled successfully, false otherwise.
    • getCraftsNet

      public CraftsNet getCraftsNet()
      Gets the CraftsNet instance associated with this handler.
      Returns:
      The CraftsNet instance.