diff --git a/core/src/main/java/org/springframework/ldap/query/ConditionCriteria.java b/core/src/main/java/org/springframework/ldap/query/ConditionCriteria.java index c8329716..bd5c026e 100644 --- a/core/src/main/java/org/springframework/ldap/query/ConditionCriteria.java +++ b/core/src/main/java/org/springframework/ldap/query/ConditionCriteria.java @@ -105,17 +105,4 @@ public interface ConditionCriteria { */ ConditionCriteria not(); - /** - * Appends an {@link org.springframework.ldap.filter.ProximityFilter}. - * @param value the value to compare with. - * @return an ContainerCriteria instance that can be used to continue append more - * criteria or as the LdapQuery instance to be used as instance to e.g. - * {@link org.springframework.ldap.core.LdapOperations#search(LdapQuery, org.springframework.ldap.core.ContextMapper)}. - * @since 3.3 - * @see org.springframework.ldap.filter.EqualsFilter - */ - default ContainerCriteria near(String value) { - throw new UnsupportedOperationException(); - } - } diff --git a/core/src/main/java/org/springframework/ldap/query/DefaultConditionCriteria.java b/core/src/main/java/org/springframework/ldap/query/DefaultConditionCriteria.java index a3d922b9..72287890 100644 --- a/core/src/main/java/org/springframework/ldap/query/DefaultConditionCriteria.java +++ b/core/src/main/java/org/springframework/ldap/query/DefaultConditionCriteria.java @@ -23,7 +23,6 @@ import org.springframework.ldap.filter.LessThanOrEqualsFilter; import org.springframework.ldap.filter.LikeFilter; import org.springframework.ldap.filter.NotFilter; import org.springframework.ldap.filter.PresentFilter; -import org.springframework.ldap.filter.ProximityFilter; import org.springframework.ldap.filter.WhitespaceWildcardsFilter; /** @@ -73,11 +72,6 @@ class DefaultConditionCriteria implements ConditionCriteria { return appendToParent(new PresentFilter(this.attribute)); } - @Override - public ContainerCriteria near(String value) { - return appendToParent(new ProximityFilter(this.attribute, value)); - } - private ContainerCriteria appendToParent(Filter filter) { return this.parent.append(negateIfApplicable(filter)); } diff --git a/core/src/test/java/org/springframework/ldap/query/LdapQueryBuilderTests.java b/core/src/test/java/org/springframework/ldap/query/LdapQueryBuilderTests.java index 543ec6b2..ce4f076e 100644 --- a/core/src/test/java/org/springframework/ldap/query/LdapQueryBuilderTests.java +++ b/core/src/test/java/org/springframework/ldap/query/LdapQueryBuilderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package org.springframework.ldap.query; import org.junit.Test; +import org.springframework.ldap.filter.ProximityFilter; import org.springframework.ldap.support.LdapUtils; import static org.assertj.core.api.Assertions.assertThat; @@ -75,7 +76,7 @@ public class LdapQueryBuilderTests { @Test public void buildProximity() { - LdapQuery result = LdapQueryBuilder.query().where("cn").near("John Doe"); + LdapQuery result = LdapQueryBuilder.query().filter(new ProximityFilter("cn", "John Doe")); assertThat(result.filter().encode()).isEqualTo("(cn~=John Doe)"); }