All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.speedment.jpastreamer.field.internal.predicate.string.StringNotEqualIgnoreCasePredicate 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.string;


import com.speedment.jpastreamer.field.predicate.PredicateType;
import com.speedment.jpastreamer.field.trait.HasReferenceValue;

/**
 *
 * @param   the entity type
 *
 * @author  Emil Forslund
 * @since   3.0.11
 */
public final class StringNotEqualIgnoreCasePredicate
extends AbstractStringPredicate {

    public StringNotEqualIgnoreCasePredicate(
            final HasReferenceValue field,
            final String lowerCase) {

        super(PredicateType.NOT_EQUAL_IGNORE_CASE, field, lowerCase, entity -> {
            final String fieldValue = field.get(entity);
            return fieldValue != null
                && !fieldValue.equalsIgnoreCase(lowerCase);
        });
    }

    @Override
    public StringEqualIgnoreCasePredicate negate() {
        return new StringEqualIgnoreCasePredicate<>(getField(), get0());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy