com.speedment.jpastreamer.field.internal.predicate.chars.CharNotInPredicate Maven / Gradle / Ivy
/*
* JPAstreamer - Express JPA queries with Java Streams
* Copyright (c) 2020-2020, Speedment, Inc. All Rights Reserved.
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* See: https://github.com/speedment/jpa-streamer/blob/master/LICENSE
*/
package com.speedment.jpastreamer.field.internal.predicate.chars;
import com.speedment.jpastreamer.field.internal.predicate.AbstractFieldPredicate;
import com.speedment.jpastreamer.field.predicate.PredicateType;
import com.speedment.jpastreamer.field.trait.HasArg0;
import com.speedment.jpastreamer.field.trait.HasCharValue;
import java.util.Set;
import static java.util.Objects.requireNonNull;
/**
* A predicate that evaluates if a value is not included in a set of chars.
*
* @param entity type
* @param database type
*
* @author Emil Forslund
* @since 3.0.11
*/
public final class CharNotInPredicate
extends AbstractFieldPredicate>
implements HasArg0> {
private final Set set;
public CharNotInPredicate(HasCharValue field, Set set) {
super(PredicateType.NOT_IN, field, entity -> !set.contains(field.getAsChar(entity)));
this.set = requireNonNull(set);
}
@Override
public Set get0() {
return set;
}
@Override
public CharInPredicate negate() {
return new CharInPredicate<>(getField(), set);
}
}