Class SocketService.Builder<B extends SocketService.Builder<B>>

Type Parameters:
B - the type of the Builder that is returned
All Implemented Interfaces:
BuilderInterface
Direct Known Subclasses:
ThreadedSocketService.Builder
Enclosing class:
SocketService

public static class SocketService.Builder<B extends SocketService.Builder<B>> extends SocketListener.Builder<B>
Inner class implementing a builder pattern to construct a GObject with properties.
Since:
2.22
  • Constructor Details

    • Builder

      protected Builder()
      Default constructor for a Builder object.
  • Method Details

    • build

      public SocketService build()
      Finish building the SocketService object. This will call GObject.withProperties(Type, String[], Value[]) to create a new GObject instance, which is then cast to SocketService.
      Overrides:
      build in class SocketListener.Builder<B extends SocketService.Builder<B>>
      Returns:
      a new instance of SocketService with the properties that were set in the Builder object.
    • setActive

      public B setActive(boolean active)
      Whether the service is currently accepting connections.
      Parameters:
      active - the value for the active property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.46
    • onIncoming

      public B onIncoming(SocketService.IncomingCallback handler)

      The ::incoming signal is emitted when a new incoming connection to service needs to be handled. The handler must initiate the handling of connection, but may not block; in essence, asynchronous operations must be used.

      connection will be unreffed once the signal handler returns, so you need to ref it yourself if you are planning to use it.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.22
      See Also: