java/alt2xml-lib-input/src/cz/frantovo/alt2xml/Alt2XmlRegexReaderFactory.java
author František Kučera <franta-hg@frantovo.cz>
Sun, 08 Jun 2014 00:01:29 +0200
changeset 35 106c5d280835
parent 32 ecc2731a5a46
child 36 ad36a104623f
permissions -rw-r--r--
zapomenutý .jar
franta-hg@15
     1
/**
franta-hg@15
     2
 * Alt2XML
franta-hg@15
     3
 * Copyright © 2014 František Kučera (frantovo.cz)
franta-hg@15
     4
 *
franta-hg@15
     5
 * This program is free software: you can redistribute it and/or modify
franta-hg@15
     6
 * it under the terms of the GNU General Public License as published by
franta-hg@15
     7
 * the Free Software Foundation, either version 3 of the License, or
franta-hg@15
     8
 * (at your option) any later version.
franta-hg@15
     9
 *
franta-hg@15
    10
 * This program is distributed in the hope that it will be useful,
franta-hg@15
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
franta-hg@15
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
franta-hg@15
    13
 * GNU General Public License for more details.
franta-hg@15
    14
 *
franta-hg@15
    15
 * You should have received a copy of the GNU General Public License
franta-hg@15
    16
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
franta-hg@15
    17
 */
franta-hg@15
    18
package cz.frantovo.alt2xml;
franta-hg@15
    19
franta-hg@15
    20
import java.util.regex.Pattern;
franta-hg@15
    21
franta-hg@15
    22
/**
franta-hg@15
    23
 * Factory for XMLReaders that can read documents with systemId defined by given pattern (typically
franta-hg@15
    24
 * file extension like .ini, .properties etc.)
franta-hg@15
    25
 *
franta-hg@15
    26
 * @author Ing. František Kučera (frantovo.cz)
franta-hg@15
    27
 */
franta-hg@15
    28
public abstract class Alt2XmlRegexReaderFactory implements Alt2XmlReaderFactory {
franta-hg@15
    29
franta-hg@15
    30
	protected abstract Pattern getSystemIdPattern();
franta-hg@15
    31
franta-hg@15
    32
	@Override
franta-hg@15
    33
	public boolean canRead(String systemId) {
franta-hg@15
    34
		return getSystemIdPattern().matcher(systemId).matches();
franta-hg@15
    35
	}
franta-hg@15
    36
}