/* * Copyright (c) [2011-2016] "Pivotal Software, Inc." / "Neo Technology" / "Graph Aware Ltd." * * This product is licensed to you under the Apache License, Version 2.0 (the "License"). * You may not use this product except in compliance with the License. * * This product may include a number of subcomponents with * separate copyright notices and license terms. Your use of the source * code for these subcomponents is subject to the terms and * conditions of the subcomponent's license, as noted in the LICENSE file. * */ package org.springframework.data.neo4j.repository.query.derived.builder; import static org.springframework.data.repository.query.parser.Part.Type.*; import java.util.Collections; import java.util.List; import java.util.Stack; import org.neo4j.ogm.cypher.BooleanOperator; import org.neo4j.ogm.cypher.ComparisonOperator; import org.neo4j.ogm.cypher.Filter; import org.springframework.data.repository.query.parser.Part; /** * @author Jasper Blues * @author Nicolas Mervaillie */ public class IsNullFilterBuilder extends FilterBuilder { public IsNullFilterBuilder(Part part, BooleanOperator booleanOperator, Class<?> entityType) { super(part, booleanOperator, entityType); } @Override public List<Filter> build(Stack<Object> params) { Filter filter = new Filter(propertyName(), ComparisonOperator.IS_NULL); filter.setOwnerEntityType(entityType); filter.setBooleanOperator(booleanOperator); filter.setNegated(isNegated() || part.getType() == IS_NOT_NULL); setNestedAttributes(part, filter); return Collections.singletonList(filter); } }