1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty5.bootstrap;
17
18 import io.netty5.channel.ChannelHandler;
19 import io.netty5.channel.ChannelOption;
20 import io.netty5.channel.EventLoopGroup;
21 import io.netty5.channel.ServerChannel;
22 import io.netty5.channel.ServerChannelFactory;
23 import io.netty5.util.AttributeKey;
24 import io.netty5.util.internal.StringUtil;
25
26 import java.util.Map;
27
28
29
30
31 public final class ServerBootstrapConfig extends AbstractBootstrapConfig<ServerBootstrap, ServerChannel,
32 ServerChannelFactory<? extends ServerChannel>> {
33
34 ServerBootstrapConfig(ServerBootstrap bootstrap) {
35 super(bootstrap);
36 }
37
38
39
40
41
42 @SuppressWarnings("deprecation")
43 public EventLoopGroup childGroup() {
44 return bootstrap.childGroup();
45 }
46
47
48
49
50
51 public ChannelHandler childHandler() {
52 return bootstrap.childHandler();
53 }
54
55
56
57
58 public Map<ChannelOption<?>, Object> childOptions() {
59 return bootstrap.childOptions();
60 }
61
62
63
64
65 public Map<AttributeKey<?>, Object> childAttrs() {
66 return bootstrap.childAttrs();
67 }
68
69 @Override
70 public ServerChannelFactory<? extends ServerChannel> channelFactory() {
71 return bootstrap.channelFactory;
72 }
73
74 @Override
75 public String toString() {
76 StringBuilder buf = new StringBuilder(super.toString());
77 buf.setLength(buf.length() - 1);
78 buf.append(", ");
79 EventLoopGroup childGroup = childGroup();
80 if (childGroup != null) {
81 buf.append("childGroup: ");
82 buf.append(StringUtil.simpleClassName(childGroup));
83 buf.append(", ");
84 }
85 Map<ChannelOption<?>, Object> childOptions = childOptions();
86 if (!childOptions.isEmpty()) {
87 buf.append("childOptions: ");
88 buf.append(childOptions);
89 buf.append(", ");
90 }
91 Map<AttributeKey<?>, Object> childAttrs = childAttrs();
92 if (!childAttrs.isEmpty()) {
93 buf.append("childAttrs: ");
94 buf.append(childAttrs);
95 buf.append(", ");
96 }
97 ChannelHandler childHandler = childHandler();
98 if (childHandler != null) {
99 buf.append("childHandler: ");
100 buf.append(childHandler);
101 buf.append(", ");
102 }
103 if (buf.charAt(buf.length() - 1) == '(') {
104 buf.append(')');
105 } else {
106 buf.setCharAt(buf.length() - 2, ')');
107 buf.setLength(buf.length() - 1);
108 }
109
110 return buf.toString();
111 }
112 }