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