Class ServerBuilder
java.lang.Object
com.iohao.net.framework.protocol.ServerBuilder
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Build and return a newServerinstance from the current configuration.intgetId()getIp()getName()getTag()setBarSkeleton(BarSkeleton barSkeleton) setId(int id) setServerType(ServerTypeEnum serverType)
-
Constructor Details
-
ServerBuilder
public ServerBuilder()
-
-
Method Details
-
build
Build and return a newServerinstance from the current configuration.Applies default values for any unset fields, extracts command routes from the
BarSkeletonif present, and registers the skeleton withBarSkeletonManager.- Returns:
- the constructed
Server - Throws:
NullPointerException- ifnamehas not been set
-
setId
- Returns:
this.
-
setName
- Returns:
this.
-
setTag
- Returns:
this.
-
setIp
- Returns:
this.
-
setBarSkeleton
- Returns:
this.
-
setServerType
- Returns:
this.
-
getId
public int getId() -
getName
-
getTag
-
getIp
-
getBarSkeleton
-
getServerType
-