1. /*
  2. * @(#)Fidelity.java 1.8 04/05/05
  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.standard;
  8. import javax.print.attribute.Attribute;
  9. import javax.print.attribute.EnumSyntax;
  10. import javax.print.attribute.PrintJobAttribute;
  11. import javax.print.attribute.PrintRequestAttribute;
  12. /**
  13. * Class Fidelity is a printing attribute class, an enumeration,
  14. * that indicates whether total fidelity to client supplied print request
  15. * attributes is required.
  16. * If FIDELITY_TRUE is specified and a service cannot print the job exactly
  17. * as specified it must reject the job.
  18. * If FIDELITY_FALSE is specified a reasonable attempt to print the job is
  19. * acceptable. If not supplied the default is FIDELITY_FALSE.
  20. *
  21. * <P>
  22. * <B>IPP Compatibility:</B> The IPP boolean value is "true" for FIDELITY_TRUE
  23. * and "false" for FIDELITY_FALSE. The category name returned by
  24. * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
  25. * integer value is the IPP enum value. The <code>toString()</code> method
  26. * returns the IPP string representation of the attribute value.
  27. * See <a href="www.ietf.org/rfc/rfc2911.txt">RFC 2911</a> Section 15.1 for
  28. * a fuller description of the IPP fidelity attribute.
  29. * <P>
  30. *
  31. */
  32. public final class Fidelity extends EnumSyntax
  33. implements PrintJobAttribute, PrintRequestAttribute {
  34. private static final long serialVersionUID = 6320827847329172308L;
  35. /**
  36. * The job must be printed exactly as specified. or else rejected.
  37. */
  38. public static final Fidelity
  39. FIDELITY_TRUE = new Fidelity(0);
  40. /**
  41. * The printer should make reasonable attempts to print the job,
  42. * even if it cannot print it exactly as specified.
  43. */
  44. public static final Fidelity
  45. FIDELITY_FALSE = new Fidelity(1);
  46. /**
  47. * Construct a new fidelity enumeration value with the
  48. * given integer value.
  49. *
  50. * @param value Integer value.
  51. */
  52. protected Fidelity(int value) {
  53. super (value);
  54. }
  55. private static final String[] myStringTable = {
  56. "true",
  57. "false"
  58. };
  59. private static final Fidelity[] myEnumValueTable = {
  60. FIDELITY_TRUE,
  61. FIDELITY_FALSE
  62. };
  63. /**
  64. * Returns the string table for class Fidelity.
  65. */
  66. protected String[] getStringTable() {
  67. return myStringTable;
  68. }
  69. /**
  70. * Returns the enumeration value table for class Fidelity.
  71. */
  72. protected EnumSyntax[] getEnumValueTable() {
  73. return myEnumValueTable;
  74. } /**
  75. * Get the printing attribute class which is to be used as the "category"
  76. * for this printing attribute value.
  77. * <P>
  78. * For class Fidelity the category is class Fidelity itself.
  79. *
  80. * @return Printing attribute class (category), an instance of class
  81. * {@link java.lang.Class java.lang.Class}.
  82. */
  83. public final Class<? extends Attribute> getCategory() {
  84. return Fidelity.class;
  85. }
  86. /**
  87. * Get the name of the category of which this attribute value is an
  88. * instance.
  89. * <P>
  90. * For class Fidelity the category name is
  91. * <CODE>"ipp-attribute-fidelity"</CODE>.
  92. *
  93. * @return Attribute category name.
  94. */
  95. public final String getName() {
  96. return "ipp-attribute-fidelity";
  97. }
  98. }