1. /*
  2. * @(#)HashDocAttributeSet.java 1.6 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.print.attribute;
  8. import java.io.Serializable;
  9. /**
  10. * Class HashDocAttributeSet provides an attribute set which
  11. * inherits its implementation from class {@link HashAttributeSet
  12. * HashAttributeSet} and enforces the semantic restrictions of interface {@link
  13. * DocAttributeSet DocAttributeSet}.
  14. * <P>
  15. *
  16. * @author Alan Kaminsky
  17. */
  18. public class HashDocAttributeSet extends HashAttributeSet
  19. implements DocAttributeSet, Serializable {
  20. private static final long serialVersionUID = -1128534486061432528L;
  21. /**
  22. * Construct a new, empty hash doc attribute set.
  23. */
  24. public HashDocAttributeSet() {
  25. super (DocAttribute.class);
  26. }
  27. /**
  28. * Construct a new hash doc attribute set,
  29. * initially populated with the given value.
  30. *
  31. * @param attribute Attribute value to add to the set.
  32. *
  33. * @exception NullPointerException
  34. * (unchecked exception) Thrown if <CODE>attribute</CODE> is null.
  35. */
  36. public HashDocAttributeSet(DocAttribute attribute) {
  37. super (attribute, DocAttribute.class);
  38. }
  39. /**
  40. * Construct a new hash doc attribute set,
  41. * initially populated with the values from the given array.
  42. * The new attribute set is populated by
  43. * adding the elements of <CODE>attributes</CODE> array to the set in
  44. * sequence, starting at index 0. Thus, later array elements may replace
  45. * earlier array elements if the array contains duplicate attribute
  46. * values or attribute categories.
  47. *
  48. * @param attributes Array of attribute values to add to the set.
  49. * If null, an empty attribute set is constructed.
  50. *
  51. * @exception NullPointerException
  52. * (unchecked exception)
  53. * Thrown if any element of <CODE>attributes</CODE> is null.
  54. */
  55. public HashDocAttributeSet(DocAttribute[] attributes) {
  56. super (attributes, DocAttribute.class);
  57. }
  58. /**
  59. * Construct a new attribute set, initially populated with the
  60. * values from the given set where the members of the attribute set
  61. * are restricted to the <code>DocAttribute</code> interface.
  62. *
  63. * @param attributes set of attribute values to initialise the set. If
  64. * null, an empty attribute set is constructed.
  65. *
  66. * @exception ClassCastException
  67. * (unchecked exception) Thrown if any element of
  68. * <CODE>attributes</CODE> is not an instance of
  69. * <CODE>DocAttribute</CODE>.
  70. */
  71. public HashDocAttributeSet(DocAttributeSet attributes) {
  72. super(attributes, DocAttribute.class);
  73. }
  74. }