
org.everit.json.schema.regexp.JavaUtilRegexpFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.everit.json.schema Show documentation
Show all versions of org.everit.json.schema Show documentation
This is a fork of the implementation of the JSON Schema Core Draft v4 specification built with the org.json API which also supports internationalization
The newest version!
package org.everit.json.schema.regexp;
import java.util.Optional;
import java.util.regex.Pattern;
class JavaUtilRegexp extends AbstractRegexp {
private final Pattern pattern;
JavaUtilRegexp(String pattern) {
super(pattern);
this.pattern = Pattern.compile(pattern);
}
@Override public Optional patternMatchingFailure(String input) {
if (pattern.matcher(input).find()) {
return Optional.empty();
} else {
return Optional.of(new RegexpMatchingFailure());
}
}
}
public class JavaUtilRegexpFactory implements RegexpFactory {
@Override public Regexp createHandler(String regexp) {
return new JavaUtilRegexp(regexp);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy