@SuppressWarnings("unchecked") public List<ProcessorDefinition> getOutputs() { if (otherwise != null) { return otherwise.getOutputs(); } else if (whenClauses.isEmpty()) { return Collections.EMPTY_LIST; } else { WhenDefinition when = whenClauses.get(whenClauses.size() - 1); return when.getOutputs(); } }
@Override public Processor createProcessor(RouteContext routeContext) throws Exception { List<FilterProcessor> filters = new ArrayList<FilterProcessor>(); for (WhenDefinition whenClaus : whenClauses) { filters.add(whenClaus.createProcessor(routeContext)); } Processor otherwiseProcessor = null; if (otherwise != null) { otherwiseProcessor = otherwise.createProcessor(routeContext); } return new ChoiceProcessor(filters, otherwiseProcessor); }
/** * Sets the otherwise node * * @return the builder */ public ChoiceDefinition otherwise() { OtherwiseDefinition answer = new OtherwiseDefinition(); answer.setParent(this); setOtherwise(answer); return this; }