private <R> ExecuteCommand<RestAction<R>, RestCallback<R>> wrapCommand( ExecuteCommand<RestAction<R>, RestCallback<R>> command) { return (newAction, newCallback) -> { onExecute(newAction); RestCallback<R> callbackWrapper = wrapCallback(newAction); return command.execute(newAction, callbackWrapper); }; }
@Override public <R> DispatchRequest doFilter( RestAction<R> action, RestCallback<R> resultCallback, ExecuteCommand<RestAction<R>, RestCallback<R>> executeCommand) { if (filterIterator.hasNext()) { Entry<RestContext, RestFilter> filterEntry = filterIterator.next(); RestContext subjectContext = new RestContext.Builder(action).build(); if (filterEntry.getKey().equals(subjectContext)) { return filterEntry.getValue().filter(action, resultCallback, executeCommand, this); } else { return doFilter(action, resultCallback, executeCommand); } } else { return executeCommand.execute(action, resultCallback); } } }
} else { DispatchRequest request = executeCommand.execute(action, new AsyncCallback<R>() { @Override