Example usage for org.apache.commons.lang3.text StrMatcher charSetMatcher

List of usage examples for org.apache.commons.lang3.text StrMatcher charSetMatcher

Introduction

In this page you can find the example usage for org.apache.commons.lang3.text StrMatcher charSetMatcher.

Prototype

public static StrMatcher charSetMatcher(final String chars) 

Source Link

Document

Constructor that creates a matcher from a string representing a set of characters.

Usage

From source file:com.jkoolcloud.tnt4j.streams.parsers.ActivityTokenParser.java

@Override
public void setProperties(Collection<Map.Entry<String, String>> props) throws Exception {
    if (props == null) {
        return;//from  w  w w. ja va2  s.c  om
    }

    super.setProperties(props);

    for (Map.Entry<String, String> prop : props) {
        String name = prop.getKey();
        String value = prop.getValue();
        if (ParserProperties.PROP_FLD_DELIM.equalsIgnoreCase(name)) {
            fieldDelim = StringUtils.isEmpty(value) ? null : StrMatcher.charSetMatcher(value);
            logger().log(OpLevel.DEBUG,
                    StreamsResources.getString(StreamsResources.RESOURCE_BUNDLE_NAME, "ActivityParser.setting"),
                    name, value);
        } else if (ParserProperties.PROP_PATTERN.equalsIgnoreCase(name)) {
            if (StringUtils.isNotEmpty(value)) {
                pattern = Pattern.compile(value);
                logger().log(OpLevel.DEBUG, StreamsResources.getString(StreamsResources.RESOURCE_BUNDLE_NAME,
                        "ActivityParser.setting"), name, value);
            }
        } else if (ParserProperties.PROP_STRIP_QUOTES.equalsIgnoreCase(name)) {
            stripQuotes = Boolean.parseBoolean(value);
            logger().log(OpLevel.TRACE,
                    StreamsResources.getString(StreamsResources.RESOURCE_BUNDLE_NAME, "ActivityParser.setting"),
                    name, value);
        }
    }
}

From source file:com.jkoolcloud.tnt4j.streams.parsers.ActivityNameValueParser.java

@Override
public void setProperties(Collection<Map.Entry<String, String>> props) throws Exception {
    if (props == null) {
        return;// w  ww . ja v  a  2s.  c o  m
    }

    super.setProperties(props);

    for (Map.Entry<String, String> prop : props) {
        String name = prop.getKey();
        String value = prop.getValue();
        if (ParserProperties.PROP_FLD_DELIM.equals(name)) {
            fieldDelim = StringUtils.isEmpty(value) ? null : StrMatcher.charSetMatcher(value);
            logger().log(OpLevel.DEBUG,
                    StreamsResources.getString(StreamsResources.RESOURCE_BUNDLE_NAME, "ActivityParser.setting"),
                    name, value);
        } else if (ParserProperties.PROP_VAL_DELIM.equals(name)) {
            valueDelim = value;
            logger().log(OpLevel.DEBUG,
                    StreamsResources.getString(StreamsResources.RESOURCE_BUNDLE_NAME, "ActivityParser.setting"),
                    name, value);
        } else if (ParserProperties.PROP_PATTERN.equals(name)) {
            if (StringUtils.isNotEmpty(value)) {
                pattern = Pattern.compile(value);
                logger().log(OpLevel.DEBUG, StreamsResources.getString(StreamsResources.RESOURCE_BUNDLE_NAME,
                        "ActivityParser.setting"), name, value);
            }
        } else if (ParserProperties.PROP_STRIP_QUOTES.equals(name)) {
            stripQuotes = Boolean.parseBoolean(value);
            logger().log(OpLevel.DEBUG,
                    StreamsResources.getString(StreamsResources.RESOURCE_BUNDLE_NAME, "ActivityParser.setting"),
                    name, value);
        }
    }
}