@Override public boolean equals(@Nullable Object other) { if (this == other) { return true; } if (other == null || getClass() != other.getClass()) { return false; } AbstractNameValueExpression<?> that = (AbstractNameValueExpression<?>) other; return ((isCaseSensitiveName() ? this.name.equals(that.name) : this.name.equalsIgnoreCase(that.name)) && ObjectUtils.nullSafeEquals(this.value, that.value) && this.isNegated == that.isNegated); }
public final boolean match(ServerWebExchange exchange) { boolean isMatch; if (this.value != null) { isMatch = matchValue(exchange); } else { isMatch = matchName(exchange); } return this.isNegated != isMatch; }
AbstractNameValueExpression(String expression) { int separator = expression.indexOf('='); if (separator == -1) { this.isNegated = expression.startsWith("!"); this.name = (this.isNegated ? expression.substring(1) : expression); this.value = null; } else { this.isNegated = (separator > 0) && (expression.charAt(separator - 1) == '!'); this.name = (this.isNegated ? expression.substring(0, separator - 1) : expression.substring(0, separator)); this.value = parseValue(expression.substring(separator + 1)); } }
public final boolean match(ServerWebExchange exchange) { boolean isMatch; if (this.value != null) { isMatch = matchValue(exchange); } else { isMatch = matchName(exchange); } return this.isNegated != isMatch; }
@Override public int hashCode() { int result = (isCaseSensitiveName() ? this.name : this.name.toLowerCase()).hashCode(); result = 31 * result + ObjectUtils.nullSafeHashCode(this.value); result = 31 * result + (this.isNegated ? 1 : 0); return result; }
AbstractNameValueExpression(String expression) { int separator = expression.indexOf('='); if (separator == -1) { this.isNegated = expression.startsWith("!"); this.name = isNegated ? expression.substring(1) : expression; this.value = null; } else { this.isNegated = (separator > 0) && (expression.charAt(separator - 1) == '!'); this.name = isNegated ? expression.substring(0, separator - 1) : expression.substring(0, separator); this.value = parseValue(expression.substring(separator + 1)); } }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj != null && obj instanceof AbstractNameValueExpression) { AbstractNameValueExpression<?> other = (AbstractNameValueExpression<?>) obj; String thisName = isCaseSensitiveName() ? this.name : this.name.toLowerCase(); String otherName = isCaseSensitiveName() ? other.name : other.name.toLowerCase(); return ((thisName.equalsIgnoreCase(otherName)) && (this.value != null ? this.value.equals(other.value) : other.value == null) && this.isNegated == other.isNegated); } return false; }
@Override public int hashCode() { int result = isCaseSensitiveName() ? name.hashCode() : name.toLowerCase().hashCode(); result = 31 * result + (value != null ? value.hashCode() : 0); result = 31 * result + (isNegated ? 1 : 0); return result; }