001package jmri.jmrix.ztc.ztc611.configurexml; 002 003import jmri.jmrix.lenz.configurexml.AbstractXNetSerialConnectionConfigXml; 004import jmri.jmrix.ztc.ztc611.ConnectionConfig; 005import jmri.jmrix.ztc.ztc611.ZTC611Adapter; 006 007/** 008 * Handle XML persistance of layout connections by persistening the 009 * ZTC611Adapter (and connections). Note this is named as the XML version of a 010 * ConnectionConfig object, but it's actually persisting the ZTC611Adapter. 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 017 */ 018public class ConnectionConfigXml extends AbstractXNetSerialConnectionConfigXml { 019 020 public ConnectionConfigXml() { 021 super(); 022 } 023 024 @Override 025 protected void getInstance() { 026 if (adapter == null) { 027 adapter = new ZTC611Adapter(); 028 } 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}