001/**
002 *
003 */
004package jmri.configurexml.turnoutoperations;
005
006import jmri.NoFeedbackTurnoutOperation;
007import jmri.TurnoutOperation;
008import org.jdom2.Element;
009import org.slf4j.Logger;
010import org.slf4j.LoggerFactory;
011
012/**
013 * Concrete subclass to save/restore SensorTurnoutOperation object to/from XML.
014 * Most of the work is done by CommonTurnoutOperationXml
015 *
016 * @author John Harper Copyright 2005
017 *
018 */
019public class SensorTurnoutOperationXml extends CommonTurnoutOperationXml {
020
021    /**
022     * called for a newly-constructed object to load it from an XML element
023     *
024     * @param e the XML element of type "turnoutOperation"
025     */
026    @Override
027    public TurnoutOperation loadOne(Element e) {
028        try {
029            Class<?> myOpClass = Class.forName("jmri.SensorTurnoutOperation");
030            return super.loadOne(e, myOpClass.getConstructor(new Class[]{String.class, int.class, int.class}),
031                    NoFeedbackTurnoutOperation.getDefaultIntervalStatic(),
032                    NoFeedbackTurnoutOperation.getDefaultMaxTriesStatic());
033        } catch (ClassNotFoundException e1) {
034            log.error("while creating NoFeedbackTurnoutOperation", e1);
035            return null;
036        } catch (NoSuchMethodException e2) {
037            log.error("while creating NoFeedbackTurnoutOperation", e2);
038            return null;
039        }
040    }
041
042    private final static Logger log = LoggerFactory.getLogger(SensorTurnoutOperationXml.class);
043}