001package jmri.jmrix.rfid.serialdriver.configurexml;
002
003import jmri.jmrix.configurexml.AbstractSerialConnectionConfigXml;
004import jmri.jmrix.rfid.serialdriver.ConnectionConfig;
005import jmri.jmrix.rfid.serialdriver.SerialDriverAdapter;
006import org.slf4j.Logger;
007import org.slf4j.LoggerFactory;
008
009
010/**
011 * Handle XML persistence of layout connections by persisting the
012 * SerialDriverAdapter (and connections). Note this is named as the XML version
013 * of a ConnectionConfig object, but it's actually persisting the
014 * SerialDriverAdapter.
015 * <p>
016 * This class is invoked from jmrix.JmrixConfigPaneXml on write, as that class
017 * is the one actually registered. Reads are brought here directly via the class
018 * attribute in the XML.
019 *
020 * @author Bob Jacobsen Copyright: Copyright (c) 2003, 2006, 2007, 2008
021 * @author Matthew Harris Copyright (C) 2011
022 * @since 2.11.4
023 */
024public class ConnectionConfigXml extends AbstractSerialConnectionConfigXml {
025
026    public ConnectionConfigXml() {
027        super();
028    }
029
030    @Override
031    protected void getInstance() {
032        log.debug("getInstance without parameter called");
033        adapter = new SerialDriverAdapter();
034    }
035
036    @Override
037    protected void getInstance(Object object) {
038        log.debug("getInstance with parameter called");
039        adapter = ((ConnectionConfig) object).getAdapter();
040    }
041
042    @Override
043    protected void register() {
044        this.register(new ConnectionConfig(adapter));
045    }
046
047    private final static Logger log = LoggerFactory.getLogger(ConnectionConfigXml.class);
048}