KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > impl > ior > iiop > AlternateIIOPAddressComponentImpl


1 /*
2  * @(#)AlternateIIOPAddressComponentImpl.java 1.20 04/06/21
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package com.sun.corba.se.impl.ior.iiop;
9
10 import org.omg.CORBA_2_3.portable.OutputStream JavaDoc ;
11
12 import com.sun.corba.se.spi.ior.TaggedComponentBase ;
13
14 import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
15 import com.sun.corba.se.spi.ior.iiop.AlternateIIOPAddressComponent ;
16
17 import org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS JavaDoc ;
18
19 /**
20  * @author Ken Cavanaugh
21  */

22 public class AlternateIIOPAddressComponentImpl extends TaggedComponentBase
23     implements AlternateIIOPAddressComponent
24 {
25     private IIOPAddress addr ;
26
27     public boolean equals( Object JavaDoc obj )
28     {
29     if (!(obj instanceof AlternateIIOPAddressComponentImpl))
30         return false ;
31
32     AlternateIIOPAddressComponentImpl other =
33         (AlternateIIOPAddressComponentImpl)obj ;
34
35     return addr.equals( other.addr ) ;
36     }
37      
38     public int hashCode()
39     {
40     return addr.hashCode() ;
41     }
42
43     public String JavaDoc toString()
44     {
45     return "AlternateIIOPAddressComponentImpl[addr=" + addr + "]" ;
46     }
47
48     public AlternateIIOPAddressComponentImpl( IIOPAddress addr )
49     {
50     this.addr = addr ;
51     }
52     
53     public IIOPAddress getAddress()
54     {
55     return addr ;
56     }
57
58     public void writeContents(OutputStream JavaDoc os)
59     {
60     addr.write( os ) ;
61     }
62     
63     public int getId()
64     {
65     return TAG_ALTERNATE_IIOP_ADDRESS.value ; // 3 in CORBA 2.3.1 13.6.3
66
}
67 }
68
Popular Tags