run.halo.app.extension.index.query.NotEqual Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of api Show documentation
Show all versions of api Show documentation
API of halo project, connecting by other projects.
The newest version!
package run.halo.app.extension.index.query;
import java.util.NavigableSet;
import org.springframework.util.Assert;
public class NotEqual extends SimpleQuery {
private final EqualQuery equalQuery;
public NotEqual(String fieldName, String value) {
this(fieldName, value, false);
}
public NotEqual(String fieldName, String value, boolean isFieldRef) {
super(fieldName, value, isFieldRef);
Assert.notNull(value, "Value must not be null, use IsNull or IsNotNull instead");
this.equalQuery = new EqualQuery(fieldName, value, isFieldRef);
}
@Override
public NavigableSet matches(QueryIndexView indexView) {
indexView.acquireReadLock();
try {
NavigableSet equalNames = equalQuery.matches(indexView);
NavigableSet allNames = indexView.getAllIds();
allNames.removeAll(equalNames);
return allNames;
} finally {
indexView.releaseReadLock();
}
}
@Override
public String toString() {
return fieldName + " != " + (isFieldRef ? value : "'" + value + "'");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy