001package jmri.jmrix.loconet.usb_dcs52.configurexml;
002
003import jmri.jmrix.configurexml.AbstractSerialConnectionConfigXml;
004import jmri.jmrix.loconet.usb_dcs52.ConnectionConfig;
005import jmri.jmrix.loconet.usb_dcs52.UsbDcs52Adapter;
006
007/**
008 * Handle XML persistance of layout connections by persisting the UsbDcs52Adapter
009 * (and connections). Note this is named as the XML version of a
010 * ConnectionConfig object, but it's actually persisting the UsbDcs52Adapter.
011 * <p>
012 * This class is invoked from jmrix.JmrixConfigPaneXml on write, as that class
013 * is the one actually registered. Reads are brought here directly via the class
014 * attribute in the XML.
015 *
016 * Based on loconet.pr3.configurexml.ConnectionConfigXml.java
017 * 
018 * @author Bob Jacobsen Copyright: Copyright (c) 2003, 2005, 2006, 2008
019 * @author B. Milhaupt Copyright (C) 2019
020 */
021public class ConnectionConfigXml extends AbstractSerialConnectionConfigXml {
022
023    @Override
024    protected void getInstance() {
025        adapter = new UsbDcs52Adapter();
026    }
027
028    @Override
029    protected void getInstance(Object object) {
030        adapter = ((ConnectionConfig) object).getAdapter();
031    }
032
033    @Override
034    protected void register() {
035        super.register(new ConnectionConfig(adapter));
036    }
037
038}