/** * Combine the request conditions held by the two RequestConditionHolder * instances after making sure the conditions are of the same type. * Or if one holder is empty, the other holder is returned. */ @Override public RequestConditionHolder combine(RequestConditionHolder other) { if (this.condition == null && other.condition == null) { return this; } else if (this.condition == null) { return other; } else if (other.condition == null) { return this; } else { assertEqualConditionTypes(this.condition, other.condition); RequestCondition<?> combined = (RequestCondition<?>) this.condition.combine(other.condition); return new RequestConditionHolder(combined); } }
/** * Compare the request conditions held by the two RequestConditionHolder * instances after making sure the conditions are of the same type. * Or if one holder is empty, the other holder is preferred. */ @Override public int compareTo(RequestConditionHolder other, ServerWebExchange exchange) { if (this.condition == null && other.condition == null) { return 0; } else if (this.condition == null) { return 1; } else if (other.condition == null) { return -1; } else { assertEqualConditionTypes(this.condition, other.condition); return this.condition.compareTo(other.condition, exchange); } }
/** * Get the matching condition for the held request condition wrap it in a * new RequestConditionHolder instance. Or otherwise if this is an empty * holder, return the same holder instance. */ @Override public RequestConditionHolder getMatchingCondition(ServerWebExchange exchange) { if (this.condition == null) { return this; } RequestCondition<?> match = (RequestCondition<?>) this.condition.getMatchingCondition(exchange); return (match != null ? new RequestConditionHolder(match) : null); }
/** * Get the matching condition for the held request condition wrap it in a * new RequestConditionHolder instance. Or otherwise if this is an empty * holder, return the same holder instance. */ @Override public RequestConditionHolder getMatchingCondition(ServerWebExchange exchange) { if (this.condition == null) { return this; } RequestCondition<?> match = (RequestCondition<?>) this.condition.getMatchingCondition(exchange); return (match != null ? new RequestConditionHolder(match) : null); }
/** * Compare the request conditions held by the two RequestConditionHolder * instances after making sure the conditions are of the same type. * Or if one holder is empty, the other holder is preferred. */ @Override public int compareTo(RequestConditionHolder other, ServerWebExchange exchange) { if (this.condition == null && other.condition == null) { return 0; } else if (this.condition == null) { return 1; } else if (other.condition == null) { return -1; } else { assertEqualConditionTypes(other); return this.condition.compareTo(other.condition, exchange); } }
/** * Combine the request conditions held by the two RequestConditionHolder * instances after making sure the conditions are of the same type. * Or if one holder is empty, the other holder is returned. */ @Override public RequestConditionHolder combine(RequestConditionHolder other) { if (this.condition == null && other.condition == null) { return this; } else if (this.condition == null) { return other; } else if (other.condition == null) { return this; } else { assertEqualConditionTypes(other); RequestCondition<?> combined = (RequestCondition<?>) this.condition.combine(other.condition); return new RequestConditionHolder(combined); } }