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

scouter.util.matcher.ChainedStrMatcher Maven / Gradle / Ivy

There is a newer version: 2.20.0
Show newest version
package scouter.util.matcher;

import scouter.util.StrMatch;
import scouter.util.StringUtil;

import java.util.ArrayList;

/**
 * @author Gun Lee ([email protected]) on 2017. 7. 8.
 */
public class ChainedStrMatcher {
    ArrayList strMatches = new ArrayList();

    public ChainedStrMatcher(String patterns, String separator) {
        this(patterns, separator, '*');
    }

    public ChainedStrMatcher(String patterns, String separator, char c) {
        String[] arrPatterns = StringUtil.split(patterns, separator);
        for (String pattern : arrPatterns) {
            strMatches.add(new StrMatch(pattern));
        }
    }

    public boolean isMatch(String target) {
        for (StrMatch match : strMatches) {
            if (match.include(target)) {
                return true;
            }
        }
        return false;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy