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

org.unix4j.convert.PatternConverters Maven / Gradle / Ivy

There is a newer version: 0.6
Show newest version
package org.unix4j.convert;

import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;

public class PatternConverters {
	public static final ValueConverter STRING = new ValueConverter() {
		@Override
		public Pattern convert(Object value) throws IllegalArgumentException {
			if (value != null) {
				try {
					return Pattern.compile(value.toString());
				} catch (PatternSyntaxException e) {
					//ignore, we just can't convert this string
				}
			}
			return null;
		}
	};
	public static final ValueConverter DEFAULT = STRING;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy