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