classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] [generics] Patch: FYI: generics for javax.print


From: Tom Tromey
Subject: [cp-patches] [generics] Patch: FYI: generics for javax.print
Date: Sun, 27 Nov 2005 14:57:23 -0700

I'm checking this in on the generics branch.

This genericizes javax.print.

Tom

2005-11-27  Tom Tromey  <address@hidden>

        * javax/print/attribute/standard/PrinterStateReasons.java:
        Genericized.
        * javax/print/attribute/standard/JobStateReasons.java: Genericized.
        * javax/print/PrintService.java (getAttribute): Genericized.
        (getDefaultAttributeValue): Likewise.
        (getSupportedAttributeCategories): Likewise.
        (getSupportedAttributeValues): Likewise.
        (isAttributeValueSupported): Likewise.


Index: javax/print/PrintService.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/print/PrintService.java,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 PrintService.java
--- javax/print/PrintService.java       2 Aug 2005 20:12:36 -0000       1.1.2.1
+++ javax/print/PrintService.java       27 Nov 2005 22:07:47 -0000
@@ -77,7 +77,7 @@
    * @throws IllegalArgumentException if category is not a class that
    * implements <code>PrintServiceAttribute</code>
    */
-  PrintServiceAttribute getAttribute(Class category);
+  <T extends PrintServiceAttribute> T getAttribute(Class<T> category);
   
   /**
    * Returns all attributes of this printer service
@@ -97,7 +97,7 @@
    * @throws IllegalArgumentException if <code>category</code> is a class
    * not implementing <code>Attribute</code> 
    */
-  Object getDefaultAttributeValue(Class category);
+  Object getDefaultAttributeValue(Class<? extends Attribute> category);
   
   /**
    * Returns the name of this print service.
@@ -118,7 +118,7 @@
    * 
    * @return an array of all supported attribute categories
    */
-  Class[] getSupportedAttributeCategories();
+  Class<?>[] getSupportedAttributeCategories();
   
   /**
    * Returns all supported attribute values a client can use when setting up
@@ -137,7 +137,9 @@
    * implementing <code>Attribute</code>, or if <code>flavor</code> is not
    * supported
    */
-  Object getSupportedAttributeValues(Class category, DocFlavor flavor, 
AttributeSet attributes);
+  Object getSupportedAttributeValues(Class<? extends Attribute> category,
+                                     DocFlavor flavor,
+                                     AttributeSet attributes);
   
   /**
    * Returns an array of all supproted document flavors.
@@ -179,7 +181,7 @@
    * @throws IllegalArgumentException if <code>category</code> is a class not
    * implementing <code>Attribute</code>.
    */
-  boolean isAttributeCategorySupported(Class category);
+  boolean isAttributeCategorySupported(Class<? extends Attribute> category);
   
   /**
    * Determines a given attribute value is supported when creating a print job
Index: javax/print/attribute/standard/JobStateReasons.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/print/attribute/standard/JobStateReasons.java,v
retrieving revision 1.2.2.2
diff -u -r1.2.2.2 JobStateReasons.java
--- javax/print/attribute/standard/JobStateReasons.java 2 Aug 2005 20:12:36 
-0000       1.2.2.2
+++ javax/print/attribute/standard/JobStateReasons.java 27 Nov 2005 22:07:47 
-0000
@@ -45,7 +45,7 @@
 /**
  * @author Michael Koch (address@hidden)
  */
-public final class JobStateReasons extends HashSet
+public final class JobStateReasons extends HashSet<JobStateReason>
   implements PrintJobAttribute
 {
   private static final long serialVersionUID = 8849088261264331812L;
Index: javax/print/attribute/standard/PrinterStateReasons.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/print/attribute/standard/PrinterStateReasons.java,v
retrieving revision 1.2.2.2
diff -u -r1.2.2.2 PrinterStateReasons.java
--- javax/print/attribute/standard/PrinterStateReasons.java     2 Aug 2005 
20:12:36 -0000       1.2.2.2
+++ javax/print/attribute/standard/PrinterStateReasons.java     27 Nov 2005 
22:07:47 -0000
@@ -45,7 +45,8 @@
 /**
  * @author Michael Koch (address@hidden)
  */
-public final class PrinterStateReasons extends HashMap
+public final class PrinterStateReasons
+  extends HashMap<PrinterStateReason, Severity>
   implements PrintServiceAttribute
 {
   private static final long serialVersionUID = -3731791085163619457L;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]