protected Action newInstance(ActionInstance actionInstance) { try { return actionInstance.getAction().newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new RuntimeException( String.format( "Exception occurred while creating an action instance of type %s: %s", actionInstance.getAction(), e.getMessage())); } }
@Override public void validate(ActionInstance actionInstance) { if (actionInstance == null) { throw new IllegalArgumentException("actionInstance cannot be null"); } if (actionInstance.getName() == null || "".equals(actionInstance.getName())) { throw new IllegalArgumentException("name for the actionInstance cannot be null or empty"); } if (actionInstance.getAction() == null) { throw new IllegalArgumentException("No Action class specified for the actionInstance"); } if (actionInstance.getTrigger() != null) { actionInstance.getTrigger().validate(); } }