001package jmri.jmrix.loconet.bluetooth.configurexml;
002
003import jmri.jmrix.configurexml.AbstractSerialConnectionConfigXml;
004import jmri.jmrix.loconet.bluetooth.ConnectionConfig;
005import jmri.jmrix.loconet.bluetooth.LocoNetBluetoothAdapter;
006
007/**
008 * Handle XML persistance of layout connections by persistening the
009 * LocoNetBluetoothAdapter (and connections). Note this is named as the XML version of
010 * a ConnectionConfig object, but it's actually persisting the
011 * LocoNetBluetoothAdapter.
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 */
017public class ConnectionConfigXml extends AbstractSerialConnectionConfigXml {
018
019    public ConnectionConfigXml() {
020        super();
021    }
022
023    @Override
024    protected void getInstance() {
025        adapter = new LocoNetBluetoothAdapter();
026    }
027
028    @Override
029    protected void getInstance(Object object) {
030        adapter = ((ConnectionConfig) object).getAdapter();
031    }
032
033    @Override
034    protected void register() {
035        this.register(new ConnectionConfig(adapter));
036    }
037
038}