-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Keywords implements ProtocolCommand (#24)
* Keywords implements ProtocolCommand * remove duplicated code
- Loading branch information
Showing
4 changed files
with
34 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 9 additions & 3 deletions
12
src/main/java/io/rebloom/client/Keyword.java → ...main/java/io/rebloom/client/Keywords.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,24 @@ | ||
package io.rebloom.client; | ||
|
||
import redis.clients.jedis.commands.ProtocolCommand; | ||
import redis.clients.jedis.util.SafeEncoder; | ||
|
||
import java.util.Locale; | ||
|
||
public enum Keyword { | ||
public enum Keywords implements ProtocolCommand { | ||
CAPACITY, | ||
ERROR, | ||
NOCREATE, | ||
ITEMS; | ||
|
||
public final byte[] raw; | ||
private final byte[] raw; | ||
|
||
Keyword() { | ||
Keywords() { | ||
raw = SafeEncoder.encode(this.name().toLowerCase(Locale.ENGLISH)); | ||
} | ||
|
||
@Override | ||
public byte[] getRaw() { | ||
return raw; | ||
} | ||
} |