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. package com.sun.corba.se.impl.ior.iiop;
  8. import org.omg.CORBA_2_3.portable.OutputStream ;
  9. import com.sun.corba.se.spi.ior.TaggedComponentBase ;
  10. import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
  11. import com.sun.corba.se.spi.ior.iiop.AlternateIIOPAddressComponent ;
  12. import org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS ;
  13. /**
  14. * @author Ken Cavanaugh
  15. */
  16. public class AlternateIIOPAddressComponentImpl extends TaggedComponentBase
  17. implements AlternateIIOPAddressComponent
  18. {
  19. private IIOPAddress addr ;
  20. public boolean equals( Object obj )
  21. {
  22. if (!(obj instanceof AlternateIIOPAddressComponentImpl))
  23. return false ;
  24. AlternateIIOPAddressComponentImpl other =
  25. (AlternateIIOPAddressComponentImpl)obj ;
  26. return addr.equals( other.addr ) ;
  27. }
  28. public int hashCode()
  29. {
  30. return addr.hashCode() ;
  31. }
  32. public String toString()
  33. {
  34. return "AlternateIIOPAddressComponentImpl[addr=" + addr + "]" ;
  35. }
  36. public AlternateIIOPAddressComponentImpl( IIOPAddress addr )
  37. {
  38. this.addr = addr ;
  39. }
  40. public IIOPAddress getAddress()
  41. {
  42. return addr ;
  43. }
  44. public void writeContents(OutputStream os)
  45. {
  46. addr.write( os ) ;
  47. }
  48. public int getId()
  49. {
  50. return TAG_ALTERNATE_IIOP_ADDRESS.value ; // 3 in CORBA 2.3.1 13.6.3
  51. }
  52. }