1. /*
  2. * @(#)StringRefAddr.java 1.4 00/02/02
  3. *
  4. * Copyright 1999, 2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package javax.naming;
  11. /**
  12. * This class represents the string form of the address of
  13. * a communications end-point.
  14. * It consists of a type that describes the communication mechanism
  15. * and a string contents specific to that communication mechanism.
  16. * The format and interpretation of
  17. * the address type and the contents of the address are based on
  18. * the agreement of three parties: the client that uses the address,
  19. * the object/server that can be reached using the address, and the
  20. * administrator or program that creates the address.
  21. *
  22. * <p> An example of a string reference address is a host name.
  23. * Another example of a string reference address is a URL.
  24. *
  25. * <p> A string reference address is immutable:
  26. * once created, it cannot be changed. Multithreaded access to
  27. * a single StringRefAddr need not be synchronized.
  28. *
  29. * @author Rosanna Lee
  30. * @author Scott Seligman
  31. * @version 1.4 00/02/02
  32. *
  33. * @see RefAddr
  34. * @see BinaryRefAddr
  35. * @since 1.3
  36. */
  37. public class StringRefAddr extends RefAddr {
  38. /**
  39. * Contains the contents of this address.
  40. * Can be null.
  41. * @serial
  42. */
  43. private String contents;
  44. /**
  45. * Constructs a new instance of StringRefAddr using its address type
  46. * and contents.
  47. *
  48. * @param addrType A non-null string describing the type of the address.
  49. * @param addr The possibly null contents of the address in the form of a string.
  50. */
  51. public StringRefAddr(String addrType, String addr) {
  52. super(addrType);
  53. contents = addr;
  54. }
  55. /**
  56. * Retrieves the contents of this address. The result is a string.
  57. *
  58. * @return The possibly null address contents.
  59. */
  60. public Object getContent() {
  61. return contents;
  62. }
  63. /**
  64. * Use serialVersionUID from JNDI 1.1.1 for interoperability
  65. */
  66. private static final long serialVersionUID = -8913762495138505527L;
  67. }