List of usage examples for io.netty.util.internal TypeParameterMatcher get
public static TypeParameterMatcher get(final Class<?> parameterType)
From source file:com.comphenix.protocol.compat.netty.independent.NettyChannelInjector.java
License:Open Source License
/** * This method patches the encoder so that it skips already created packets. * @param encoder - the encoder to patch. *///from ww w. j a va2s. c o m private void patchEncoder(MessageToByteEncoder<Object> encoder) { if (ENCODER_TYPE_MATCHER == null) { ENCODER_TYPE_MATCHER = Accessors.getFieldAccessor(encoder.getClass(), "matcher", true); } ENCODER_TYPE_MATCHER.set(encoder, TypeParameterMatcher.get(MinecraftReflection.getPacketClass())); }
From source file:org.diorite.impl.connection.ByteToMessageCodec.java
License:Open Source License
/** * Create a new instance/*w w w . j a va 2 s . c o m*/ * * @param outboundMessageType The type of messages to match * @param preferDirect {@code true} if a direct {@link ByteBuf} should be tried to be used as target for * the encoded messages. If {@code false} is used it will allocate a heap * {@link ByteBuf}, which is backed by an byte array. */ protected ByteToMessageCodec(final Class<? extends I> outboundMessageType, final boolean preferDirect) { this.outboundMsgMatcher = TypeParameterMatcher.get(outboundMessageType); this.encoder = new Encoder(preferDirect); }