Class ServerBuilder

java.lang.Object
com.iohao.net.framework.protocol.ServerBuilder

public final class ServerBuilder extends Object
Builder for constructing Server instances with sensible defaults.

Provides a fluent API to configure server identity (id, name, tag), network address, server type, and the associated BarSkeleton. When build() is called, unset fields receive default values: a random id, the name as tag, LOGIC server type, and the local IP address. If a BarSkeleton is provided, its command routes are extracted and registered with BarSkeletonManager.

Since:
25.1
Author:
渔民小镇
date:
2025-08-26
  • Constructor Details

    • ServerBuilder

      public ServerBuilder()
  • Method Details

    • build

      public Server build()
      Build and return a new Server instance from the current configuration.

      Applies default values for any unset fields, extracts command routes from the BarSkeleton if present, and registers the skeleton with BarSkeletonManager.

      Returns:
      the constructed Server
      Throws:
      NullPointerException - if name has not been set