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