@Override public List<? extends BitFieldAction> getActionsByCode(int actionCode) { List<MyComponentAction> actions = Lists.newArrayList(); for (MyComponentActionType action : MyComponentActionType.getActionByCode(actionCode)) { actions.add(new MyComponentAction(action)); } return actions; }
static List<MyComponentActionType> getActionByCode(int code) { List<MyComponentActionType> actions = Lists.newArrayList(); for (MyComponentActionType action : MyComponentActionType.values()) { if ((action.code & code) == action.code && action != MyComponentActionType.ALL) { //MyComponentActionType.ALL action should not return in the list actions.add(action); } } if (actions.isEmpty()) { throw new RuntimeException("can't get sqoopActionType by code:" + code); } return actions; } }
static List<MyComponentActionType> getActionByCode(int code) { List<MyComponentActionType> actions = Lists.newArrayList(); for (MyComponentActionType action : MyComponentActionType.values()) { if ((action.code & code) == action.code && action != MyComponentActionType.ALL) { //MyComponentActionType.ALL action should not return in the list actions.add(action); } } if (actions.isEmpty()) { throw new RuntimeException("can't get sqoopActionType by code:" + code); } return actions; } }
public MyComponentAction(String name) { this(MyComponentActionType.getActionByName(name)); } public MyComponentAction(MyComponentActionType myComponentActionType) {
public MyComponentAction(String name) { this(MyComponentActionType.getActionByName(name)); } public MyComponentAction(MyComponentActionType myComponentActionType) {
@Override public List<? extends BitFieldAction> getActionsByCode(int actionCode) { List<MyComponentAction> actions = Lists.newArrayList(); for (MyComponentActionType action : MyComponentActionType.getActionByCode(actionCode)) { actions.add(new MyComponentAction(action)); } return actions; }
static MyComponentActionType getActionByName(String name) { for (MyComponentActionType action : MyComponentActionType.values()) { if (action.name.equalsIgnoreCase(name)) { return action; } } throw new RuntimeException("can't get MyComponentActionType by name:" + name); }
static MyComponentActionType getActionByName(String name) { for (MyComponentActionType action : MyComponentActionType.values()) { if (action.name.equalsIgnoreCase(name)) { return action; } } throw new RuntimeException("can't get MyComponentActionType by name:" + name); }