Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita committed Jul 13, 2015
1 parent 88241cb commit 6dcbf7c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 162 deletions.
5 changes: 4 additions & 1 deletion src/main/java/org/redisson/client/handler/RedisEncoder.java
Expand Up @@ -16,6 +16,7 @@
package org.redisson.client.handler; package org.redisson.client.handler;


import org.redisson.client.protocol.Encoder; import org.redisson.client.protocol.Encoder;
import org.redisson.client.protocol.StringParamsEncoder;
import org.redisson.client.protocol.RedisCommand.ValueType; import org.redisson.client.protocol.RedisCommand.ValueType;


import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
Expand All @@ -25,6 +26,8 @@


public class RedisEncoder extends MessageToByteEncoder<RedisData<Object, Object>> { public class RedisEncoder extends MessageToByteEncoder<RedisData<Object, Object>> {


private final Encoder paramsEncoder = new StringParamsEncoder();

final char ARGS_PREFIX = '*'; final char ARGS_PREFIX = '*';
final char BYTES_PREFIX = '$'; final char BYTES_PREFIX = '$';
final byte[] CRLF = "\r\n".getBytes(); final byte[] CRLF = "\r\n".getBytes();
Expand All @@ -45,7 +48,7 @@ protected void encode(ChannelHandlerContext ctx, RedisData<Object, Object> msg,
} }
int i = 1; int i = 1;
for (Object param : msg.getParams()) { for (Object param : msg.getParams()) {
Encoder encoder = msg.getCommand().getParamsEncoder(); Encoder encoder = paramsEncoder;
if (msg.getCommand().getInParamType().size() == 1) { if (msg.getCommand().getInParamType().size() == 1) {
if (msg.getCommand().getInParamIndex() == i && msg.getCommand().getInParamType().get(0) == ValueType.OBJECT) { if (msg.getCommand().getInParamIndex() == i && msg.getCommand().getInParamType().get(0) == ValueType.OBJECT) {
encoder = msg.getCodec().getValueEncoder(); encoder = msg.getCodec().getValueEncoder();
Expand Down
74 changes: 0 additions & 74 deletions src/main/java/org/redisson/client/protocol/IntegerCodec.java

This file was deleted.

5 changes: 0 additions & 5 deletions src/main/java/org/redisson/client/protocol/RedisCommand.java
Expand Up @@ -31,7 +31,6 @@ public enum ValueType {OBJECT, MAP_VALUE, MAP_KEY, MAP}
private final String name; private final String name;
private final String subName; private final String subName;


private Encoder paramsEncoder = new StringParamsEncoder();
private MultiDecoder<R> replayMultiDecoder; private MultiDecoder<R> replayMultiDecoder;
private Decoder<R> replayDecoder; private Decoder<R> replayDecoder;
private Convertor<R> convertor = new EmptyConvertor<R>(); private Convertor<R> convertor = new EmptyConvertor<R>();
Expand Down Expand Up @@ -172,10 +171,6 @@ public Convertor<R> getConvertor() {
return convertor; return convertor;
} }


public Encoder getParamsEncoder() {
return paramsEncoder;
}

public List<ValueType> getInParamType() { public List<ValueType> getInParamType() {
return inParamType; return inParamType;
} }
Expand Down
82 changes: 0 additions & 82 deletions src/main/java/org/redisson/client/protocol/StringIntegerCodec.java

This file was deleted.

0 comments on commit 6dcbf7c

Please sign in to comment.