franta-hg@68: /**
franta-hg@68: * Alt2XML
franta-hg@68: * Copyright © 2014 František Kučera (frantovo.cz)
franta-hg@68: *
franta-hg@68: * This program is free software: you can redistribute it and/or modify
franta-hg@68: * it under the terms of the GNU General Public License as published by
franta-hg@68: * the Free Software Foundation, either version 3 of the License, or
franta-hg@68: * (at your option) any later version.
franta-hg@68: *
franta-hg@68: * This program is distributed in the hope that it will be useful,
franta-hg@68: * but WITHOUT ANY WARRANTY; without even the implied warranty of
franta-hg@68: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
franta-hg@68: * GNU General Public License for more details.
franta-hg@68: *
franta-hg@68: * You should have received a copy of the GNU General Public License
franta-hg@68: * along with this program. If not, see .
franta-hg@68: */
franta-hg@68: package cz.frantovo.alt2xml.out.xpath;
franta-hg@68:
franta-hg@69: import java.util.Map;
franta-hg@68: import javax.xml.namespace.QName;
franta-hg@68: import javax.xml.xpath.XPathVariableResolver;
franta-hg@68:
franta-hg@68: /**
franta-hg@68: *
franta-hg@68: * @author Ing. František Kučera (frantovo.cz)
franta-hg@68: */
franta-hg@68: public class PropertiesVariableResolver implements XPathVariableResolver {
franta-hg@68:
franta-hg@69: private Map data;
franta-hg@68:
franta-hg@69: public PropertiesVariableResolver(Map data) {
franta-hg@68: this.data = data;
franta-hg@68: }
franta-hg@68:
franta-hg@68: @Override
franta-hg@68: public Object resolveVariable(QName variableName) {
franta-hg@69: return data.get(variableName.getLocalPart());
franta-hg@68: }
franta-hg@68:
franta-hg@68: }