001package jmri.jmrix.roco.z21.configurexml; 002 003import jmri.jmrix.configurexml.AbstractNetworkConnectionConfigXml; 004import jmri.jmrix.roco.z21.ConnectionConfig; 005import jmri.jmrix.roco.z21.Z21Adapter; 006 007/** 008 * Handle XML persistance of layout connections by persistening the Z21 (and 009 * connections). 010 * <p> 011 * This class is invoked from jmrix.JmrixConfigPaneXml on write, as that class 012 * is the one actually registered. Reads are brought here directly via the class 013 * attribute in the XML. 014 * 015 * @author Paul Bender Copyright (C) 2014 016 */ 017public class ConnectionConfigXml extends AbstractNetworkConnectionConfigXml { 018 019 public ConnectionConfigXml() { 020 super(); 021 } 022 023 @Override 024 protected void getInstance() { 025 if (adapter == null) { 026 adapter = new Z21Adapter(); 027 } 028 } 029 030 @Override 031 protected void getInstance(Object object) { 032 adapter = ((ConnectionConfig) object).getAdapter(); 033 } 034 035 @Override 036 protected void register() { 037 this.register(new ConnectionConfig(adapter)); 038 } 039 040}