Created
July 19, 2017 00:26
-
-
Save mouselabsio/15df8024d161e4687cd100d07b2f41c7 to your computer and use it in GitHub Desktop.
el suyo
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
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