KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > config > schema > L2ConfigForL1


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.config.schema;
5
6 import org.apache.commons.lang.builder.EqualsBuilder;
7 import org.apache.commons.lang.builder.HashCodeBuilder;
8
9 import com.tc.config.schema.dynamic.ObjectArrayConfigItem;
10 import com.tc.util.Assert;
11 import com.tc.util.stringification.OurStringBuilder;
12
13 /**
14  * Contains the information from the L2s that L1 needs.
15  */

16 public interface L2ConfigForL1 {
17
18   public static class L2Data {
19     private final String JavaDoc host;
20     private final int dsoPort;
21
22     public L2Data(String JavaDoc host, int dsoPort) {
23       Assert.assertNotBlank(host);
24       this.host = host;
25       this.dsoPort = dsoPort;
26     }
27
28     public String JavaDoc host() {
29       return this.host;
30     }
31
32     public int dsoPort() {
33       return this.dsoPort;
34     }
35
36     public boolean equals(Object JavaDoc that) {
37       if (!(that instanceof L2Data)) return false;
38       L2Data thatData = (L2Data) that;
39       return new EqualsBuilder().append(this.host, thatData.host)
40           .append(this.dsoPort, thatData.dsoPort).isEquals();
41     }
42
43     public int hashCode() {
44       return new HashCodeBuilder().append(this.host).append(this.dsoPort).toHashCode();
45     }
46
47     public String JavaDoc toString() {
48       return new OurStringBuilder(this).append("host", this.host)
49           .append("DSO port", this.dsoPort).toString();
50     }
51   }
52
53   ObjectArrayConfigItem l2Data();
54
55 }
56
Popular Tags