1 4 package com.tc.object.config; 5 6 import com.tc.config.schema.L2ConfigForL1.L2Data; 7 import com.tc.config.schema.dynamic.ConfigItem; 8 import com.tc.config.schema.dynamic.DerivedConfigItem; 9 import com.tc.net.core.ConnectionInfo; 10 import com.tc.util.Assert; 11 import com.tc.util.stringification.OurStringBuilder; 12 13 16 public class ConnectionInfoConfigItem extends DerivedConfigItem { 17 public ConnectionInfoConfigItem(ConfigItem l2DataConfigItem) { 18 super(new ConfigItem[] { l2DataConfigItem }); 19 } 20 21 protected Object createValueFrom(ConfigItem[] fromWhich) { 22 Assert.eval(fromWhich.length == 1); 23 24 L2Data[] l2Data = (L2Data[]) fromWhich[0].getObject(); 25 ConnectionInfo[] out = new ConnectionInfo[l2Data.length]; 26 27 for (int i = 0; i < out.length; ++i) { 28 out[i] = new ConnectionInfo(l2Data[i].host(), l2Data[i].dsoPort()); 29 } 30 31 return out; 32 } 33 34 public String toString() { 35 return new OurStringBuilder(this, OurStringBuilder.COMPACT_STYLE).appendSuper(super.toString()).toString(); 36 } 37 } | Popular Tags |