Replace constructor calls on UniqueName and its subtypes with valueOf() wherever possible
This commit is contained in:
parent
8986245b47
commit
1c2352e6a0
@ -61,7 +61,7 @@ public class WebSocketServerProtocolHandler extends WebSocketProtocolHandler {
|
||||
}
|
||||
|
||||
private static final AttributeKey<WebSocketServerHandshaker> HANDSHAKER_ATTR_KEY =
|
||||
new AttributeKey<WebSocketServerHandshaker>(WebSocketServerHandshaker.class.getName());
|
||||
AttributeKey.valueOf(WebSocketServerHandshaker.class.getName() + ".HANDSHAKER");
|
||||
|
||||
private final String websocketPath;
|
||||
private final String subprotocols;
|
||||
|
@ -19,8 +19,8 @@ import io.netty.util.Signal;
|
||||
|
||||
public class DecoderResult {
|
||||
|
||||
protected static final Signal SIGNAL_UNFINISHED = new Signal(DecoderResult.class.getName() + ".UNFINISHED");
|
||||
protected static final Signal SIGNAL_SUCCESS = new Signal(DecoderResult.class.getName() + ".SUCCESS");
|
||||
protected static final Signal SIGNAL_UNFINISHED = Signal.valueOf(DecoderResult.class.getName() + ".UNFINISHED");
|
||||
protected static final Signal SIGNAL_SUCCESS = Signal.valueOf(DecoderResult.class.getName() + ".SUCCESS");
|
||||
|
||||
public static final DecoderResult UNFINISHED = new DecoderResult(SIGNAL_UNFINISHED);
|
||||
public static final DecoderResult SUCCESS = new DecoderResult(SIGNAL_SUCCESS);
|
||||
|
@ -266,7 +266,7 @@ import java.util.List;
|
||||
*/
|
||||
public abstract class ReplayingDecoder<S> extends ByteToMessageDecoder {
|
||||
|
||||
static final Signal REPLAY = new Signal(ReplayingDecoder.class.getName() + ".REPLAY");
|
||||
static final Signal REPLAY = Signal.valueOf(ReplayingDecoder.class.getName() + ".REPLAY");
|
||||
|
||||
private final ReplayingDecoderBuffer replayable = new ReplayingDecoderBuffer();
|
||||
private S state;
|
||||
|
@ -20,7 +20,6 @@ import io.netty.channel.ChannelHandler;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.util.Attribute;
|
||||
import io.netty.util.AttributeKey;
|
||||
|
||||
import org.jboss.marshalling.MarshallerFactory;
|
||||
import org.jboss.marshalling.MarshallingConfiguration;
|
||||
import org.jboss.marshalling.Unmarshaller;
|
||||
@ -35,8 +34,8 @@ import org.jboss.marshalling.Unmarshaller;
|
||||
*/
|
||||
public class ContextBoundUnmarshallerProvider extends DefaultUnmarshallerProvider {
|
||||
|
||||
private static final AttributeKey<Unmarshaller> UNMARSHALLER = new AttributeKey<Unmarshaller>(
|
||||
ContextBoundUnmarshallerProvider.class.getName() + ".unmarshaller");
|
||||
private static final AttributeKey<Unmarshaller> UNMARSHALLER = AttributeKey.valueOf(
|
||||
ContextBoundUnmarshallerProvider.class.getName() + ".UNMARSHALLER");
|
||||
|
||||
public ContextBoundUnmarshallerProvider(MarshallerFactory factory, MarshallingConfiguration config) {
|
||||
super(factory, config);
|
||||
|
@ -37,7 +37,7 @@ import java.io.Serializable;
|
||||
public class CompatibleObjectEncoder extends MessageToByteEncoder<Serializable> {
|
||||
|
||||
private static final AttributeKey<ObjectOutputStream> OOS =
|
||||
new AttributeKey<ObjectOutputStream>(CompatibleObjectEncoder.class.getName() + ".oos");
|
||||
AttributeKey.valueOf(CompatibleObjectEncoder.class.getName() + ".OOS");
|
||||
|
||||
private final int resetInterval;
|
||||
private int writtenObjects;
|
||||
|
@ -39,8 +39,8 @@ public class DefaultPromise<V> extends AbstractFuture<V> implements Promise<V> {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
private static final Signal SUCCESS = new Signal(DefaultPromise.class.getName() + ".SUCCESS");
|
||||
private static final Signal UNCANCELLABLE = new Signal(DefaultPromise.class.getName() + ".UNCANCELLABLE");
|
||||
private static final Signal SUCCESS = Signal.valueOf(DefaultPromise.class.getName() + ".SUCCESS");
|
||||
private static final Signal UNCANCELLABLE = Signal.valueOf(DefaultPromise.class.getName() + ".UNCANCELLABLE");
|
||||
private final EventExecutor executor;
|
||||
|
||||
private volatile Object result;
|
||||
|
@ -15,11 +15,11 @@
|
||||
*/
|
||||
package io.netty.util;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class DefaultAttributeMapTest {
|
||||
|
||||
private DefaultAttributeMap map;
|
||||
@ -36,7 +36,7 @@ public class DefaultAttributeMapTest {
|
||||
|
||||
@Test
|
||||
public void testGetSetString() {
|
||||
AttributeKey<String> key = new AttributeKey<String>("Nothing");
|
||||
AttributeKey<String> key = AttributeKey.valueOf("Nothing");
|
||||
Attribute<String> one = map.attr(key);
|
||||
|
||||
assertSame(one, map.attr(key));
|
||||
@ -53,7 +53,7 @@ public class DefaultAttributeMapTest {
|
||||
|
||||
@Test
|
||||
public void testGetSetInt() {
|
||||
AttributeKey<Integer> key = new AttributeKey<Integer>("Nada");
|
||||
AttributeKey<Integer> key = AttributeKey.valueOf("Nada");
|
||||
Attribute<Integer> one = map.attr(key);
|
||||
|
||||
assertSame(one, map.attr(key));
|
||||
|
@ -73,8 +73,10 @@ public abstract class AbstractTrafficShapingHandler extends ChannelDuplexHandler
|
||||
*/
|
||||
protected long checkInterval = DEFAULT_CHECK_INTERVAL; // default 1 s
|
||||
|
||||
private static final AttributeKey<Boolean> READ_SUSPENDED = new AttributeKey<Boolean>("readSuspended");
|
||||
private static final AttributeKey<Runnable> REOPEN_TASK = new AttributeKey<Runnable>("reopenTask");
|
||||
private static final AttributeKey<Boolean> READ_SUSPENDED = AttributeKey.valueOf(
|
||||
AbstractTrafficShapingHandler.class.getName() + ".READ_SUSPENDED");
|
||||
private static final AttributeKey<Runnable> REOPEN_TASK = AttributeKey.valueOf(
|
||||
AbstractTrafficShapingHandler.class.getName() + ".REOPEN_TASK");
|
||||
|
||||
/**
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user