diff -r 471c0cda94c3 -r b890783e4043 java/alt2xml-lib/src/cz/frantovo/alt2xml/Alt2XmlRegexReaderFactory.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/alt2xml-lib/src/cz/frantovo/alt2xml/Alt2XmlRegexReaderFactory.java Sat Jun 07 10:38:31 2014 +0200 @@ -0,0 +1,36 @@ +/** + * Alt2XML + * Copyright © 2014 František Kučera (frantovo.cz) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package cz.frantovo.alt2xml; + +import java.util.regex.Pattern; + +/** + * Factory for XMLReaders that can read documents with systemId defined by given pattern (typically + * file extension like .ini, .properties etc.) + * + * @author Ing. František Kučera (frantovo.cz) + */ +public abstract class Alt2XmlRegexReaderFactory implements Alt2XmlReaderFactory { + + protected abstract Pattern getSystemIdPattern(); + + @Override + public boolean canRead(String systemId) { + return getSystemIdPattern().matcher(systemId).matches(); + } +}