LDAP-263: Extracted interface to minimize class coupling in query package.

This commit is contained in:
Mattias Hellborg Arthursson
2013-09-25 11:34:18 +02:00
parent 3686b7987e
commit 4f8f3bfd41
3 changed files with 31 additions and 4 deletions

View File

@@ -0,0 +1,26 @@
/*
* Copyright 2005-2013 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.query;
import org.springframework.ldap.filter.Filter;
/**
* @author Mattias Hellborg Arthursson
*/
interface AppendableContainerCriteria extends ContainerCriteria {
ContainerCriteria append(Filter filter);
}

View File

@@ -30,11 +30,11 @@ import org.springframework.ldap.filter.WhitespaceWildcardsFilter;
* @since 2.0
*/
class DefaultConditionCriteria implements ConditionCriteria {
private final DefaultContainerCriteria parent;
private final AppendableContainerCriteria parent;
private final String attribute;
private boolean negated = false;
DefaultConditionCriteria(DefaultContainerCriteria parent, String attribute) {
DefaultConditionCriteria(AppendableContainerCriteria parent, String attribute) {
this.parent = parent;
this.attribute = attribute;
}

View File

@@ -29,7 +29,7 @@ import static org.springframework.ldap.query.CriteriaContainerType.OR;
* @author Mattias Hellborg Arthursson
* @since 2.0
*/
class DefaultContainerCriteria implements ContainerCriteria {
class DefaultContainerCriteria implements AppendableContainerCriteria {
private final Set<Filter> filters = new LinkedHashSet<Filter>();
private final LdapQuery topQuery;
private CriteriaContainerType type;
@@ -38,7 +38,8 @@ class DefaultContainerCriteria implements ContainerCriteria {
this.topQuery = topQuery;
}
DefaultContainerCriteria append(Filter filter) {
@Override
public DefaultContainerCriteria append(Filter filter) {
this.filters.add(filter);
return this;
}