Home / Class/ ReflectiveChannelFactory Class — netty Architecture

ReflectiveChannelFactory Class — netty Architecture

Architecture documentation for the ReflectiveChannelFactory class in ReflectiveChannelFactory.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  3fedefca_06a8_f725_2151_e2fccc8a6071["ReflectiveChannelFactory"]
  df0b6cf7_4535_0f9e_a3f4_5d1d634564fa["ReflectiveChannelFactory.java"]
  3fedefca_06a8_f725_2151_e2fccc8a6071 -->|defined in| df0b6cf7_4535_0f9e_a3f4_5d1d634564fa
  88bfd5b8_64ff_d375_0fba_5dab37deacde["ReflectiveChannelFactory()"]
  3fedefca_06a8_f725_2151_e2fccc8a6071 -->|method| 88bfd5b8_64ff_d375_0fba_5dab37deacde
  b5c33278_38c5_653d_f1c8_867e6167cf6d["T()"]
  3fedefca_06a8_f725_2151_e2fccc8a6071 -->|method| b5c33278_38c5_653d_f1c8_867e6167cf6d
  e4e94c40_c3dc_79be_e8fe_af85c1a9039b["String()"]
  3fedefca_06a8_f725_2151_e2fccc8a6071 -->|method| e4e94c40_c3dc_79be_e8fe_af85c1a9039b

Relationship Graph

Source Code

transport/src/main/java/io/netty/channel/ReflectiveChannelFactory.java lines 27–55

public class ReflectiveChannelFactory<T extends Channel> implements ChannelFactory<T> {

    private final Constructor<? extends T> constructor;

    public ReflectiveChannelFactory(Class<? extends T> clazz) {
        ObjectUtil.checkNotNull(clazz, "clazz");
        try {
            this.constructor = clazz.getConstructor();
        } catch (NoSuchMethodException e) {
            throw new IllegalArgumentException("Class " + StringUtil.simpleClassName(clazz) +
                    " does not have a public non-arg constructor", e);
        }
    }

    @Override
    public T newChannel() {
        try {
            return constructor.newInstance();
        } catch (Throwable t) {
            throw new ChannelException("Unable to create Channel from class " + constructor.getDeclaringClass(), t);
        }
    }

    @Override
    public String toString() {
        return StringUtil.simpleClassName(ReflectiveChannelFactory.class) +
                '(' + StringUtil.simpleClassName(constructor.getDeclaringClass()) + ".class)";
    }
}

Frequently Asked Questions

What is the ReflectiveChannelFactory class?
ReflectiveChannelFactory is a class in the netty codebase, defined in transport/src/main/java/io/netty/channel/ReflectiveChannelFactory.java.
Where is ReflectiveChannelFactory defined?
ReflectiveChannelFactory is defined in transport/src/main/java/io/netty/channel/ReflectiveChannelFactory.java at line 27.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free