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

edu.stanford.protege.webprotege.match.StringEqualsMatcher Maven / Gradle / Ivy

The newest version!
package edu.stanford.protege.webprotege.match;

import edu.stanford.protege.webprotege.criteria.StringEqualsCriteria;
import org.apache.commons.lang.StringUtils;

import javax.annotation.Nonnull;

import static com.google.common.base.Preconditions.checkNotNull;

/**
 * Matthew Horridge
 * Stanford Center for Biomedical Informatics Research
 * 2020-06-23
 */
public class StringEqualsMatcher implements Matcher {

    @Nonnull
    private final StringEqualsCriteria criteria;

    public StringEqualsMatcher(@Nonnull StringEqualsCriteria criteria) {
        this.criteria = checkNotNull(criteria);
    }

    @Override
    public boolean matches(@Nonnull String value) {
        if(criteria.isIgnoreCase()) {
            return StringUtils.equalsIgnoreCase(criteria.getValue(), value);
        }
        else {
            return criteria.getValue().equals(value);
        }
    }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy