@Override public Command perform(Object... args) { Parameters parent = (Parameters) args[0]; Array<Parameter> parameters = parent.getParameters(); String field = (String) args[1]; for (Parameter parameter : parameters) { if (parameter.getName().equals(field)) { return new RemoveFromListCommand(parent, parameters, parameter); } } return null; }
public static <T extends Parameters> T buildWithParameters( Assets assets, VariablesManager variablesManager, T parameters) { if (parameters.getParameters().size > 0) { Class clazz = parameters.getClass(); Parameters clone = (Parameters) assets.fromJson(clazz, assets.toJson(parameters, clazz)); for (Parameter parameter : clone.getParameters()) { Object value = variablesManager.evaluateExpression((String) parameter.getValue()); variablesManager.getAccessor().set(clone, parameter.getName(), value); } return (T) clone; } else { return parameters; } }