001package jmri.jmrix.zimo.klug.configurexml;
002
003import jmri.jmrix.configurexml.AbstractSerialConnectionConfigXml;
004import jmri.jmrix.zimo.klug.ConnectionConfig;
005import jmri.jmrix.zimo.klug.SerialDriverAdapter;
006
007/**
008 * Handle XML persistance of layout connections by persistening the mxulfAdapter
009 * (and connections). Note this is named as the XML version of a
010 * ConnectionConfig object, but it's actually persisting the klugAdapter.
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 * @author Kevin Dickerson Copyright: Copyright (c) 2026
017 * 
018 * Adapted for use with KLUG by Jonas Gahlert 
019 */
020public class ConnectionConfigXml extends AbstractSerialConnectionConfigXml {
021
022    public ConnectionConfigXml() {
023        super();
024    }
025
026    @Override
027    protected void register() {
028        this.register(new ConnectionConfig(adapter));
029    }
030
031    @Override
032    protected void getInstance() {
033        adapter = new SerialDriverAdapter();
034    }
035
036    @Override
037    protected void getInstance(Object object) {
038        adapter = ((ConnectionConfig) object).getAdapter();
039    }
040
041}