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