@Override protected Collection<?> getContent() { return (!isEmpty() ? getConditions() : Collections.emptyList()); }
/** * If one instance is empty, the other "wins". If both instances have * conditions, compare them in the order in which they were provided. */ @Override public int compareTo(CompositeRequestCondition other, ServerWebExchange exchange) { if (isEmpty() && other.isEmpty()) { return 0; } else if (isEmpty()) { return 1; } else if (other.isEmpty()) { return -1; } else { assertNumberOfConditions(other); for (int i = 0; i < getLength(); i++) { int result = this.requestConditions[i].compareTo(other.requestConditions[i], exchange); if (result != 0) { return result; } } return 0; } }
/** * If one instance is empty, return the other. * If both instances have conditions, combine the individual conditions * after ensuring they are of the same type and number. */ @Override public CompositeRequestCondition combine(CompositeRequestCondition other) { if (isEmpty() && other.isEmpty()) { return this; } else if (other.isEmpty()) { return this; } else if (isEmpty()) { return other; } else { assertNumberOfConditions(other); RequestConditionHolder[] combinedConditions = new RequestConditionHolder[getLength()]; for (int i = 0; i < getLength(); i++) { combinedConditions[i] = this.requestConditions[i].combine(other.requestConditions[i]); } return new CompositeRequestCondition(combinedConditions); } }
/** * Delegate to <em>all</em> contained conditions to match the request and return the * resulting "matching" condition instances. * <p>An empty {@code CompositeRequestCondition} matches to all requests. */ @Override public CompositeRequestCondition getMatchingCondition(ServerWebExchange exchange) { if (isEmpty()) { return this; } RequestConditionHolder[] matchingConditions = new RequestConditionHolder[getLength()]; for (int i = 0; i < getLength(); i++) { matchingConditions[i] = this.requestConditions[i].getMatchingCondition(exchange); if (matchingConditions[i] == null) { return null; } } return new CompositeRequestCondition(matchingConditions); }
@Override protected Collection<?> getContent() { return (isEmpty()) ? Collections.emptyList() : getConditions(); }
/** * If one instance is empty, the other "wins". If both instances have * conditions, compare them in the order in which they were provided. */ @Override public int compareTo(CompositeRequestCondition other, ServerWebExchange exchange) { if (isEmpty() && other.isEmpty()) { return 0; } else if (isEmpty()) { return 1; } else if (other.isEmpty()) { return -1; } else { assertNumberOfConditions(other); for (int i = 0; i < getLength(); i++) { int result = this.requestConditions[i].compareTo(other.requestConditions[i], exchange); if (result != 0) { return result; } } return 0; } }
/** * If one instance is empty, return the other. * If both instances have conditions, combine the individual conditions * after ensuring they are of the same type and number. */ @Override public CompositeRequestCondition combine(CompositeRequestCondition other) { if (isEmpty() && other.isEmpty()) { return this; } else if (other.isEmpty()) { return this; } else if (isEmpty()) { return other; } else { assertNumberOfConditions(other); RequestConditionHolder[] combinedConditions = new RequestConditionHolder[getLength()]; for (int i = 0; i < getLength(); i++) { combinedConditions[i] = this.requestConditions[i].combine(other.requestConditions[i]); } return new CompositeRequestCondition(combinedConditions); } }
/** * Delegate to <em>all</em> contained conditions to match the request and return the * resulting "matching" condition instances. * <p>An empty {@code CompositeRequestCondition} matches to all requests. */ @Override public CompositeRequestCondition getMatchingCondition(ServerWebExchange exchange) { if (isEmpty()) { return this; } RequestConditionHolder[] matchingConditions = new RequestConditionHolder[getLength()]; for (int i = 0; i < getLength(); i++) { matchingConditions[i] = this.requestConditions[i].getMatchingCondition(exchange); if (matchingConditions[i] == null) { return null; } } return new CompositeRequestCondition(matchingConditions); }