Builder Class — netty Architecture
Architecture documentation for the Builder class in EmbeddedChannel.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 9aac6f31_383c_d46b_8c0e_4cdd3d47e770["Builder"] da14aac1_b6b5_44dd_f197_278e22c2b814["EmbeddedChannel.java"] 9aac6f31_383c_d46b_8c0e_4cdd3d47e770 -->|defined in| da14aac1_b6b5_44dd_f197_278e22c2b814 412a63fe_fa38_53e4_d2d4_c5fb1caa9c85["Builder()"] 9aac6f31_383c_d46b_8c0e_4cdd3d47e770 -->|method| 412a63fe_fa38_53e4_d2d4_c5fb1caa9c85 9a6c73bd_5d8b_0f22_bf45_7c79d12b22e8["EmbeddedChannel()"] 9aac6f31_383c_d46b_8c0e_4cdd3d47e770 -->|method| 9a6c73bd_5d8b_0f22_bf45_7c79d12b22e8
Relationship Graph
Source Code
transport/src/main/java/io/netty/channel/embedded/EmbeddedChannel.java lines 1070–1187
public static final class Builder {
Channel parent;
ChannelId channelId = EmbeddedChannelId.INSTANCE;
boolean register = true;
boolean hasDisconnect;
//you should use either handlers or handler variable, but not both.
ChannelHandler[] handlers = EMPTY_HANDLERS;
ChannelHandler handler;
ChannelConfig config;
Ticker ticker;
private Builder() {
}
/**
* The parent {@link Channel} of this {@link EmbeddedChannel}.
*
* @param parent the parent {@link Channel} of this {@link EmbeddedChannel}.
* @return This builder
*/
public Builder parent(Channel parent) {
this.parent = parent;
return this;
}
/**
* The {@link ChannelId} that will be used to identify this channel.
*
* @param channelId the {@link ChannelId} that will be used to identify this channel
* @return This builder
*/
public Builder channelId(ChannelId channelId) {
this.channelId = Objects.requireNonNull(channelId, "channelId");
return this;
}
/**
* {@code true} if this {@link Channel} is registered to the {@link EventLoop} in the constructor. If
* {@code false} the user will need to call {@link #register()}.
*
* @param register {@code true} if this {@link Channel} is registered to the {@link EventLoop} in the
* constructor. If {@code false} the user will need to call {@link #register()}.
* @return This builder
*/
public Builder register(boolean register) {
this.register = register;
return this;
}
/**
* {@code false} if this {@link Channel} will delegate {@link #disconnect()} to {@link #close()}, {@code true}
* otherwise.
*
* @param hasDisconnect {@code false} if this {@link Channel} will delegate {@link #disconnect()} to
* {@link #close()}, {@code true} otherwise
* @return This builder
*/
public Builder hasDisconnect(boolean hasDisconnect) {
this.hasDisconnect = hasDisconnect;
return this;
}
/**
* The {@link ChannelHandler}s which will be added to the {@link ChannelPipeline}.
*
* @param handlers the {@link ChannelHandler}s which will be added to the {@link ChannelPipeline}
* @return This builder
*/
public Builder handlers(ChannelHandler... handlers) {
this.handlers = Objects.requireNonNull(handlers, "handlers");
this.handler = null;
return this;
}
/**
* The {@link ChannelHandler} which will be added to the {@link ChannelPipeline}.
*
* @param handler the {@link ChannelHandler}s which will be added to the {@link ChannelPipeline}
* @return This builder
*/
public Builder handlers(ChannelHandler handler) {
Source
Frequently Asked Questions
What is the Builder class?
Builder is a class in the netty codebase, defined in transport/src/main/java/io/netty/channel/embedded/EmbeddedChannel.java.
Where is Builder defined?
Builder is defined in transport/src/main/java/io/netty/channel/embedded/EmbeddedChannel.java at line 1070.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free