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