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