ChannelMatchers Class — netty Architecture
Architecture documentation for the ChannelMatchers class in ChannelMatchers.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 2f997f8b_6c7c_f910_c154_fd1cc743c2fb["ChannelMatchers"] e9f5da97_a9fa_935b_2c56_fa4994ef23e0["ChannelMatchers.java"] 2f997f8b_6c7c_f910_c154_fd1cc743c2fb -->|defined in| e9f5da97_a9fa_935b_2c56_fa4994ef23e0 a32ef303_8fd7_46b5_399c_f05d1eeac417["ChannelMatchers()"] 2f997f8b_6c7c_f910_c154_fd1cc743c2fb -->|method| a32ef303_8fd7_46b5_399c_f05d1eeac417 5c2fec0d_198e_5c22_83ec_7b970a12ce72["ChannelMatcher()"] 2f997f8b_6c7c_f910_c154_fd1cc743c2fb -->|method| 5c2fec0d_198e_5c22_83ec_7b970a12ce72
Relationship Graph
Source Code
transport/src/main/java/io/netty/channel/group/ChannelMatchers.java lines 24–169
public final class ChannelMatchers {
private static final ChannelMatcher ALL_MATCHER = new ChannelMatcher() {
@Override
public boolean matches(Channel channel) {
return true;
}
};
private static final ChannelMatcher SERVER_CHANNEL_MATCHER = isInstanceOf(ServerChannel.class);
private static final ChannelMatcher NON_SERVER_CHANNEL_MATCHER = isNotInstanceOf(ServerChannel.class);
private ChannelMatchers() {
// static methods only
}
/**
* Returns a {@link ChannelMatcher} that matches all {@link Channel}s.
*/
public static ChannelMatcher all() {
return ALL_MATCHER;
}
/**
* Returns a {@link ChannelMatcher} that matches all {@link Channel}s except the given.
*/
public static ChannelMatcher isNot(Channel channel) {
return invert(is(channel));
}
/**
* Returns a {@link ChannelMatcher} that matches the given {@link Channel}.
*/
public static ChannelMatcher is(Channel channel) {
return new InstanceMatcher(channel);
}
/**
* Returns a {@link ChannelMatcher} that matches all {@link Channel}s that are an instance of sub-type of
* the given class.
*/
public static ChannelMatcher isInstanceOf(Class<? extends Channel> clazz) {
return new ClassMatcher(clazz);
}
/**
* Returns a {@link ChannelMatcher} that matches all {@link Channel}s that are <strong>not</strong> an
* instance of sub-type of the given class.
*/
public static ChannelMatcher isNotInstanceOf(Class<? extends Channel> clazz) {
return invert(isInstanceOf(clazz));
}
/**
* Returns a {@link ChannelMatcher} that matches all {@link Channel}s that are of type {@link ServerChannel}.
*/
public static ChannelMatcher isServerChannel() {
return SERVER_CHANNEL_MATCHER;
}
/**
* Returns a {@link ChannelMatcher} that matches all {@link Channel}s that are <strong>not</strong> of type
* {@link ServerChannel}.
*/
public static ChannelMatcher isNonServerChannel() {
return NON_SERVER_CHANNEL_MATCHER;
}
/**
* Invert the given {@link ChannelMatcher}.
*/
public static ChannelMatcher invert(ChannelMatcher matcher) {
return new InvertMatcher(matcher);
}
/**
* Return a composite of the given {@link ChannelMatcher}s. This means all {@link ChannelMatcher} must
* return {@code true} to match.
*/
public static ChannelMatcher compose(ChannelMatcher... matchers) {
if (matchers.length < 1) {
Source
Frequently Asked Questions
What is the ChannelMatchers class?
ChannelMatchers is a class in the netty codebase, defined in transport/src/main/java/io/netty/channel/group/ChannelMatchers.java.
Where is ChannelMatchers defined?
ChannelMatchers is defined in transport/src/main/java/io/netty/channel/group/ChannelMatchers.java at line 24.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free