Skip to content

Instantly share code, notes, and snippets.

@mouselabsio
Created July 19, 2017 00:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mouselabsio/15df8024d161e4687cd100d07b2f41c7 to your computer and use it in GitHub Desktop.
Save mouselabsio/15df8024d161e4687cd100d07b2f41c7 to your computer and use it in GitHub Desktop.
el suyo
package com.mgage.kronos.shared;
import org.springframework.util.StringUtils;
public class OperateCommand<V> {
private String hsetCategory;
private String keyword;
private V value;
private DATABASE_COMMAND command;
public OperateCommand(String keyword, V value, DATABASE_COMMAND command, String hsetCategory){
if (StringUtils.isEmpty(hsetCategory) && (command == DATABASE_COMMAND.ADD_TO_HSET || command == DATABASE_COMMAND.REMOVE_FROM_HSET)) {
throw new IllegalArgumentException("Need hSet Category for Hash Set command");
}
if (!StringUtils.isEmpty(hsetCategory) && !(command == DATABASE_COMMAND.ADD_TO_HSET || command == DATABASE_COMMAND.REMOVE_FROM_HSET)) {
throw new IllegalArgumentException("hSet Category was set for not Hash Set command");
}
this.keyword = keyword;
this.value = value;
this.command = command;
this.hsetCategory = hsetCategory;
}
public String getKeyword() {
return keyword;
}
public V getValue() {
return value;
}
public DATABASE_COMMAND getCommand() {
return command;
}
public String getHsetCategory() {
return hsetCategory;
}
public enum DATABASE_COMMAND {
INSERT_UPDATE,
DELETE,
ADD_TO_SET,
REMOVE_FROM_SET,
ADD_TO_HSET,
REMOVE_FROM_HSET
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment