diff options
11 files changed, 178 insertions, 114 deletions
@@ -1,5 +1,64 @@ 2010-04-28 Andrew John Hughes <ahughes@redhat.com> + * gnu/javax/print/ipp/IppPrintService.java: + (printerAttr): Add generic typing. + (printServiceAttributeListener): Likewise. + (flavors): Likewise. + (printerUris): Likewise. + (IppPrintService(URI uri, String username, String password)): + Use generic types in initialising listener set. + (getPrinterAttributes()): Add generic types. Remove cast. + (getPrinterAttributeSet(Class<T>)): Return a set containing + attributes of type T. Now creates a new set and checks that + all elements of the original set can be cast and added to this + new set. + (getPrinterDefaultAttribute(Class<? extends Attribute>)): Add + generic types. + (processResponse()): Add generic types. + (getAttribute(Class<T>)): Use generic types corresponding to + parent interface. + (getSupportedAttributeCategories()): Use generic types. + (getSupportedAttributeValues()): Likewise. + (handleSupportedAttributeValuesResponse(IppResponse,Class<? extends Attribute>)): + Likewise. + (isAttributeCategorySupported(Class<? extends Attribute>)): Likewise. + * gnu/javax/print/ipp/IppResponse.java: + (parseResponse(InputStream)): Use generic types. + (parseAttributes(Map<Class<? extends Attribute>, Set<Attribute>, DataInputStream)): + Likewise. + (addAttribute(Map<Class<? extends Attribute>, Set<Attribute>>, Attribute): Likewise. + (IppResponse(URI, short)): Create lists with appropriate type parameters. + (getJobAttributes()): Use generic return type. + (getOperationAttributes()): Likewise. + (getPrinterAttributes()): Likewise. + (getUnsupportedAttributes()): Likewise. + * gnu/javax/print/ipp/attribute/supported/CompressionSupported.java: + (getAssociatedAttributeArray(Set<Attribute>)): Use superclass Attribute + as set type parameter and cast when looping over it. + * gnu/javax/print/ipp/attribute/supported/FinishingsSupported.java, + (getAssociatedAttributeArray(Set<Attribute>)): Use superclass Attribute + as set type parameter and cast when looping over it. + * gnu/javax/print/ipp/attribute/supported/JobSheetsSupported.java, + (getAssociatedAttributeArray(Set<Attribute>)): Use superclass Attribute + as set type parameter and cast when looping over it. + * gnu/javax/print/ipp/attribute/supported/MediaSupported.java, + (getAssociatedAttributeArray(Set<Attribute>)): Use superclass Attribute + as set type parameter and cast when looping over it. + * gnu/javax/print/ipp/attribute/supported/MultipleDocumentHandlingSupported.java, + (getAssociatedAttributeArray(Set<Attribute>)): Use superclass Attribute + as set type parameter and cast when looping over it. + * gnu/javax/print/ipp/attribute/supported/OrientationRequestedSupported.java, + (getAssociatedAttributeArray(Set<Attribute>)): Use superclass Attribute + as set type parameter and cast when looping over it. + * gnu/javax/print/ipp/attribute/supported/PrintQualitySupported.java, + (getAssociatedAttributeArray(Set<Attribute>)): Use superclass Attribute + as set type parameter and cast when looping over it. + * gnu/javax/print/ipp/attribute/supported/PrinterResolutionSupported.java, + (getAssociatedAttributeArray(Set<Attribute>)): Use superclass Attribute + as set type parameter and cast when looping over it. + +2010-04-28 Andrew John Hughes <ahughes@redhat.com> + * gnu/javax/print/ipp/IppUtilities.java: (INTEGER_CLASS_ARRAY): Use generic typing. (TEXT_CLASS_ARRAY): Likewise. diff --git a/gnu/javax/print/ipp/IppPrintService.java b/gnu/javax/print/ipp/IppPrintService.java index 219bd6e03..9ce41c774 100644 --- a/gnu/javax/print/ipp/IppPrintService.java +++ b/gnu/javax/print/ipp/IppPrintService.java @@ -143,10 +143,10 @@ public class IppPrintService implements PrintService * IPP may return sets of attributes e.g. for supported * compression methods so we need to map to sets here. */ - private Map<Class<? extends Attribute>, Set<? extends Attribute>> printerAttr; + private Map<Class<? extends Attribute>, Set<Attribute>> printerAttr; /** The set of listeners.*/ - private HashSet printServiceAttributeListener; + private HashSet<PrintServiceAttributeListener> printServiceAttributeListener; /** The username. */ private transient String user; @@ -158,13 +158,13 @@ public class IppPrintService implements PrintService private String name; /** The list of supported document flavors. */ - private List flavors; + private List<DocFlavor> flavors; /** The standard printer URI. */ private PrinterURI printerUri; /** The list of all supported printer URIs. */ - private ArrayList printerUris; + private ArrayList<PrinterURI> printerUris; /** * Logger for tracing - enable by passing @@ -207,7 +207,8 @@ public class IppPrintService implements PrintService user = username; passwd = password; - printServiceAttributeListener = new HashSet(); + printServiceAttributeListener = + new HashSet<PrintServiceAttributeListener>(); printerAttr = getPrinterAttributes(); processResponse(); @@ -219,7 +220,8 @@ public class IppPrintService implements PrintService * @return The Map with the printer attributes. * @throws IppException if an error occurs. */ - private Map getPrinterAttributes() throws IppException + private Map<Class<? extends Attribute>, Set<Attribute>> getPrinterAttributes() + throws IppException { IppResponse response = null; @@ -239,7 +241,7 @@ public class IppPrintService implements PrintService throw new IppException("IOException in IPP request/response.", e); } - return (Map) response.getPrinterAttributes().get(0); + return response.getPrinterAttributes().get(0); } /** @@ -249,9 +251,13 @@ public class IppPrintService implements PrintService * @param attributeClass the category * @return The set of attributes of the category. */ - private Set getPrinterAttributeSet(Class<? extends Attribute> attributeClass) + private <T extends Attribute> Set<T> getPrinterAttributeSet(Class<T> attributeClass) { - return (Set) printerAttr.get(attributeClass); + Set<Attribute> set = printerAttr.get(attributeClass); + Set<T> attSet = new HashSet<T>(); + for (Attribute att : set) + attSet.add(attributeClass.cast(att)); + return attSet; } /** @@ -264,9 +270,9 @@ public class IppPrintService implements PrintService * @throws ClassCastException if attributClass is not an * instance of <code>DefaultValueAttribute</code>. */ - private Attribute getPrinterDefaultAttribute(Class attributeClass) + private Attribute getPrinterDefaultAttribute(Class<? extends Attribute> attributeClass) { - Set set = (Set) printerAttr.get(attributeClass); + Set<Attribute> set = printerAttr.get(attributeClass); return ((DefaultValueAttribute) set.toArray()[0]).getAssociatedAttribute(); } @@ -276,8 +282,7 @@ public class IppPrintService implements PrintService private void processResponse() { // printer name - PrinterName[] tmp = (PrinterName[]) getPrinterAttributeSet( - PrinterName.class).toArray(new PrinterName[1]); + PrinterName[] tmp = getPrinterAttributeSet(PrinterName.class).toArray(new PrinterName[1]); name = tmp[0].getValue(); // supported flavors @@ -285,13 +290,13 @@ public class IppPrintService implements PrintService // for text doc flavors as cups doesn't send charset parameters // utf-8 is supported at least - so we go with this only for now - flavors = new ArrayList(); - Set flavorAttributes = getPrinterAttributeSet(DocumentFormatSupported.class); + flavors = new ArrayList<DocFlavor>(); + Set<DocumentFormatSupported> flavorAttributes = getPrinterAttributeSet(DocumentFormatSupported.class); if (flavorAttributes != null) { - for (Iterator it = flavorAttributes.iterator(); it.hasNext();) + for (DocumentFormatSupported dfs : flavorAttributes) { - String mimeType = ((DocumentFormatSupported) it.next()).getValue(); + String mimeType = dfs.getValue(); if (mimeType.equals("text/plain")) { @@ -318,9 +323,10 @@ public class IppPrintService implements PrintService boolean changed = false; try { - Class[] clazzes = new Class[] { DocFlavor.BYTE_ARRAY.class, - DocFlavor.INPUT_STREAM.class, - DocFlavor.URL.class }; + Class<?>[] clazzes = new Class<?>[] { DocFlavor.BYTE_ARRAY.class, + DocFlavor.INPUT_STREAM.class, + DocFlavor.URL.class + }; for (int j = 0; j < clazzes.length; j++) { @@ -368,12 +374,10 @@ public class IppPrintService implements PrintService } // printer uris - Set uris = getPrinterAttributeSet(PrinterUriSupported.class); - printerUris = new ArrayList(uris.size()); - Iterator it = uris.iterator(); - while (it.hasNext()) + Set<PrinterUriSupported> uris = getPrinterAttributeSet(PrinterUriSupported.class); + printerUris = new ArrayList<PrinterURI>(uris.size()); + for (PrinterUriSupported uri : uris) { - PrinterUriSupported uri = (PrinterUriSupported) it.next(); printerUris.add( new PrinterURI(uri.getURI())); } } @@ -392,7 +396,7 @@ public class IppPrintService implements PrintService /** * @see javax.print.PrintService#getAttribute(java.lang.Class) */ - public PrintServiceAttribute getAttribute(Class category) + public <T extends PrintServiceAttribute> T getAttribute(Class<T> category) { if (category == null) throw new NullPointerException("category may not be null"); @@ -401,9 +405,9 @@ public class IppPrintService implements PrintService throw new IllegalArgumentException( "category must be of type PrintServiceAttribute"); - Set set = getPrinterAttributeSet(category); + Set<T> set = getPrinterAttributeSet(category); if (set != null && set.size() > 0) - return (PrintServiceAttribute) set.toArray()[0]; + return set.iterator().next(); return null; } @@ -415,13 +419,10 @@ public class IppPrintService implements PrintService { PrintServiceAttributeSet set = new HashPrintServiceAttributeSet(); - Iterator it = printerAttr.values().iterator(); - while (it.hasNext()) + for (Set<Attribute> attrSet : printerAttr.values()) { - Iterator it2 = ((Set) it.next()).iterator(); - while (it2.hasNext()) + for (Attribute attr : attrSet) { - Attribute attr = (Attribute) it2.next(); if (attr instanceof PrintServiceAttribute) set.add(attr); } @@ -433,7 +434,7 @@ public class IppPrintService implements PrintService /** * @see javax.print.PrintService#getDefaultAttributeValue(java.lang.Class) */ - public Object getDefaultAttributeValue(Class category) + public Object getDefaultAttributeValue(Class<? extends Attribute> category) { // required attributes if (category.equals(Fidelity.class)) @@ -515,9 +516,10 @@ public class IppPrintService implements PrintService /** * @see javax.print.PrintService#getSupportedAttributeCategories() */ - public Class[] getSupportedAttributeCategories() + public Class<?>[] getSupportedAttributeCategories() { - Set categories = new HashSet(); + Set<Class<? extends Attribute>> categories = + new HashSet<Class<? extends Attribute>>(); // Should only be job template attributes as of section 4.2 if (printerAttr.containsKey(JobPrioritySupported.class)) @@ -533,7 +535,7 @@ public class IppPrintService implements PrintService if (printerAttr.containsKey(FinishingsSupported.class)) { // if only none finishing is supported - it does not count as supported - Set set = getPrinterAttributeSet(FinishingsSupported.class); + Set<FinishingsSupported> set = getPrinterAttributeSet(FinishingsSupported.class); if (! (set.size() == 1 && set.contains(FinishingsSupported.NONE))) categories.add(Finishings.class); } @@ -570,7 +572,7 @@ public class IppPrintService implements PrintService categories.add(JobName.class); categories.add(RequestingUserName.class); - return (Class[]) categories.toArray(new Class[categories.size()]); + return categories.toArray(new Class[categories.size()]); } /** @@ -582,8 +584,8 @@ public class IppPrintService implements PrintService * @see PrintService#getSupportedAttributeValues(Class, DocFlavor, AttributeSet) * @see #handleSupportedAttributeValuesResponse(IppResponse, Class) */ - public Object getSupportedAttributeValues(Class category, DocFlavor flavor, - AttributeSet attributes) + public Object getSupportedAttributeValues(Class<? extends Attribute> category, + DocFlavor flavor, AttributeSet attributes) { // We currently ignore the attribute set - there is nothing in the IPP // specification which would come closer to what we do here. @@ -665,14 +667,15 @@ public class IppPrintService implements PrintService * @see #getSupportedAttributeValues(Class, DocFlavor, AttributeSet) */ protected Object handleSupportedAttributeValuesResponse(IppResponse response, - Class category) + Class<? extends Attribute> category) { - List printerAtts = response.getPrinterAttributes(); + List<Map<Class<? extends Attribute>, Set<Attribute>>> printerAtts = + response.getPrinterAttributes(); // only one will be returned - Map printerAttribute = (Map) printerAtts.get(0); - Class suppCategory = IppUtilities.getSupportedCategory(category); - Set attr = (Set) printerAttribute.get(suppCategory); + Map<Class<? extends Attribute>, Set<Attribute>> printerAttribute = printerAtts.get(0); + Class<? extends Attribute> suppCategory = IppUtilities.getSupportedCategory(category); + Set<Attribute> attr = printerAttribute.get(suppCategory); // We sometime assume its a single instance with arbritrary value just indicating // support or an array which is returned. This is because I sometimes just choosed @@ -681,7 +684,7 @@ public class IppPrintService implements PrintService // Map whats in the JSP API if (suppCategory.equals(JobPrioritySupported.class)) - return (JobPrioritySupported) attr.toArray(new JobPrioritySupported[1])[0]; + return (JobPrioritySupported) attr.iterator().next(); if (suppCategory.equals(JobHoldUntilSupported.class)) return new JobHoldUntil(new Date()); if (suppCategory.equals(JobSheetsSupported.class)) @@ -689,7 +692,7 @@ public class IppPrintService implements PrintService if (suppCategory.equals(MultipleDocumentHandlingSupported.class)) return MultipleDocumentHandlingSupported.getAssociatedAttributeArray(attr); if (suppCategory.equals(CopiesSupported.class)) - return (CopiesSupported) attr.toArray(new CopiesSupported[1])[0]; + return (CopiesSupported) attr.iterator().next(); if (suppCategory.equals(FinishingsSupported.class)) return FinishingsSupported.getAssociatedAttributeArray(attr); if (suppCategory.equals(PageRangesSupported.class)) @@ -707,16 +710,14 @@ public class IppPrintService implements PrintService // Special handling as it might also be in range of integers if (suppCategory.equals(NumberUpSupported.class)) { - NumberUpSupported[] tmp = (NumberUpSupported[]) - attr.toArray(new NumberUpSupported[attr.size()]); - if (attr.size() == 1) // number-up maybe in rangeofintegers - return tmp[0]; + return attr.iterator().next(); int[][] members = new int[attr.size()][2]; + Iterator<Attribute> it = attr.iterator(); for (int j = 0; j < attr.size(); j++) { - int value = tmp[j].getMembers()[0][0]; + int value = ((NumberUpSupported) it.next()).getMembers()[0][0]; members[j] = new int[] { value, value }; } @@ -732,7 +733,7 @@ public class IppPrintService implements PrintService */ public DocFlavor[] getSupportedDocFlavors() { - return (DocFlavor[]) flavors.toArray(new DocFlavor[flavors.size()]); + return flavors.toArray(new DocFlavor[flavors.size()]); } /** @@ -792,24 +793,22 @@ public class IppPrintService implements PrintService } // Validate Jobs returns only Unsupported and Operation - List unsupportedMaps = response.getUnsupportedAttributes(); + List<Map<Class<? extends Attribute>, Set<Attribute>>> unsupportedMaps = + response.getUnsupportedAttributes(); if (unsupportedMaps.size() == 0) - return null; + return null; - Map unsupportedAttr = (Map) unsupportedMaps.get(0); + Map<Class<? extends Attribute>, Set<Attribute>> unsupportedAttr = unsupportedMaps.get(0); if (unsupportedAttr.size() == 0) return null; // Convert the return map with unsupported attributes // into an AttribueSet instance HashAttributeSet set = new HashAttributeSet(); - Iterator it = unsupportedAttr.values().iterator(); - while (it.hasNext()) + for (Set<Attribute> unsupported : unsupportedAttr.values()) { - Set unsupported = (Set) it.next(); - Iterator it2 = unsupported.iterator(); - while (it2.hasNext()) - set.add((Attribute) it2.next()); + for (Attribute att : unsupported) + set.add(att); } return set; @@ -818,7 +817,7 @@ public class IppPrintService implements PrintService /** * @see PrintService#isAttributeCategorySupported(Class) */ - public boolean isAttributeCategorySupported(Class category) + public boolean isAttributeCategorySupported(Class<? extends Attribute> category) { if (category == null) throw new NullPointerException("category may not be null"); diff --git a/gnu/javax/print/ipp/IppResponse.java b/gnu/javax/print/ipp/IppResponse.java index 00de2444b..703bdc1eb 100644 --- a/gnu/javax/print/ipp/IppResponse.java +++ b/gnu/javax/print/ipp/IppResponse.java @@ -184,7 +184,7 @@ public class IppResponse byte tag = 0; boolean proceed = true; - HashMap tmp; + HashMap<Class<? extends Attribute>, Set<Attribute>> tmp; // iterate over attribute-groups until end-of-attributes-tag is found while (proceed) { @@ -200,23 +200,23 @@ public class IppResponse proceed = false; break; case IppDelimiterTag.OPERATION_ATTRIBUTES_TAG: - tmp = new HashMap(); + tmp = new HashMap<Class<? extends Attribute>, Set<Attribute>>(); tag = parseAttributes(tmp, stream); operationAttributes.add(tmp); break; case IppDelimiterTag.JOB_ATTRIBUTES_TAG: - tmp = new HashMap(); + tmp = new HashMap<Class<? extends Attribute>, Set<Attribute>>(); tag = parseAttributes(tmp, stream); jobAttributes.add(tmp); break; case IppDelimiterTag.PRINTER_ATTRIBUTES_TAG: - tmp = new HashMap(); + tmp = new HashMap<Class<? extends Attribute>, Set<Attribute>>(); tag = parseAttributes(tmp, stream); printerAttributes.add(tmp); break; case IppDelimiterTag.UNSUPPORTED_ATTRIBUTES_TAG: System.out.println("Called"); - tmp = new HashMap(); + tmp = new HashMap<Class<? extends Attribute>, Set<Attribute>>(); tag = parseAttributes(tmp, stream); unsupportedAttributes.add(tmp); break; @@ -247,7 +247,8 @@ public class IppResponse * @throws IppException if unexpected exceptions occur. * @throws IOException if IO problems with the underlying inputstream occur. */ - private byte parseAttributes(Map attributes, DataInputStream stream) + private byte parseAttributes(Map<Class<? extends Attribute>, Set<Attribute>> attributes, + DataInputStream stream) throws IppException, IOException { Attribute lastAttribute = null; @@ -386,7 +387,7 @@ public class IppResponse else if (name.equals("media-supported")) attribute = new MediaSupported(str, null); else if (name.equals("media-default")) - attribute = new MediaDefault(str, null); + attribute = new MediaDefault(str, null); else if (name.equals("job-sheets-default")) attribute = new JobSheetsDefault(str, null); else if (name.equals("job-sheets-supported")) @@ -473,7 +474,7 @@ public class IppResponse } if (attribute == null) - attribute = new UnknownAttribute(tag, name, value); + attribute = new UnknownAttribute(tag, name, value); addAttribute(attributes, attribute); lastAttribute = attribute; @@ -492,14 +493,15 @@ public class IppResponse * @param attribute * the attribute to add */ - private void addAttribute(Map attributeGroup, Attribute attribute) + private void addAttribute(Map<Class<? extends Attribute>, Set<Attribute>> attributeGroup, + Attribute attribute) { - Class clazz = attribute.getCategory(); - Set attributeValues = (Set) attributeGroup.get(clazz); + Class<? extends Attribute> clazz = attribute.getCategory(); + Set<Attribute> attributeValues = attributeGroup.get(clazz); if (attributeValues == null) // first attribute of this category { - attributeValues = new HashSet(); + attributeValues = new HashSet<Attribute>(); attributeGroup.put(clazz, attributeValues); } @@ -637,10 +639,10 @@ public class IppResponse short status_code; int request_id; - List operationAttributes; - List printerAttributes; - List jobAttributes; - List unsupportedAttributes; + List<Map<Class<? extends Attribute>, Set<Attribute>>> operationAttributes; + List<Map<Class<? extends Attribute>, Set<Attribute>>> printerAttributes; + List<Map<Class<? extends Attribute>, Set<Attribute>>> jobAttributes; + List<Map<Class<? extends Attribute>, Set<Attribute>>> unsupportedAttributes; byte[] data; @@ -654,10 +656,14 @@ public class IppResponse { this.uri = uri; this.operation_id = operation_id; - operationAttributes = new ArrayList(); - jobAttributes = new ArrayList(); - printerAttributes = new ArrayList(); - unsupportedAttributes = new ArrayList(); + operationAttributes = + new ArrayList<Map<Class<? extends Attribute>, Set<Attribute>>>(); + jobAttributes = + new ArrayList<Map<Class<? extends Attribute>, Set<Attribute>>>(); + printerAttributes = + new ArrayList<Map<Class<? extends Attribute>, Set<Attribute>>>(); + unsupportedAttributes = + new ArrayList<Map<Class<? extends Attribute>, Set<Attribute>>>(); } /** @@ -704,9 +710,9 @@ public class IppResponse * There may occur more than one group of type job attribute in a response * because of e.g. multiple job or print service informations requested. * - * @return The list of job attribute grou maps. + * @return The list of job attribute group maps. */ - public List getJobAttributes() + public List<Map<Class<? extends Attribute>, Set<Attribute>>> getJobAttributes() { return jobAttributes; } @@ -716,9 +722,9 @@ public class IppResponse * There may occur more than one group of type job attribute in a response * because of e.g. multiple job or print service informations requested. * - * @return The list of operation attribute grou maps. + * @return The list of operation attribute group maps. */ - public List getOperationAttributes() + public List<Map<Class<? extends Attribute>, Set<Attribute>>> getOperationAttributes() { return operationAttributes; } @@ -728,9 +734,9 @@ public class IppResponse * There may occur more than one group of type job attribute in a response * because of e.g. multiple job or print service informations requested. * - * @return The list of printer attribute grou maps. + * @return The list of printer attribute group maps. */ - public List getPrinterAttributes() + public List<Map<Class<? extends Attribute>, Set<Attribute>>> getPrinterAttributes() { return printerAttributes; } @@ -761,9 +767,9 @@ public class IppResponse * There may occur more than one group of type job attribute in a response * because of e.g. multiple job or print service informations requested. * - * @return The list of unsupported attribute grou maps. + * @return The list of unsupported attribute group maps. */ - public List getUnsupportedAttributes() + public List<Map<Class<? extends Attribute>, Set<Attribute>>> getUnsupportedAttributes() { return unsupportedAttributes; } diff --git a/gnu/javax/print/ipp/attribute/supported/CompressionSupported.java b/gnu/javax/print/ipp/attribute/supported/CompressionSupported.java index 56020748f..768091cb2 100644 --- a/gnu/javax/print/ipp/attribute/supported/CompressionSupported.java +++ b/gnu/javax/print/ipp/attribute/supported/CompressionSupported.java @@ -147,13 +147,13 @@ public final class CompressionSupported extends EnumSyntax * @see #getAssociatedAttribute() */ public static Compression[] - getAssociatedAttributeArray(Set<CompressionSupported> set) + getAssociatedAttributeArray(Set<Attribute> set) { Compression[] result = new Compression[set.size()]; int j = 0; - for (CompressionSupported tmp : set) + for (Attribute tmp : set) { - result[j] = tmp.getAssociatedAttribute(); + result[j] = ((CompressionSupported) tmp).getAssociatedAttribute(); j++; } return result; diff --git a/gnu/javax/print/ipp/attribute/supported/FinishingsSupported.java b/gnu/javax/print/ipp/attribute/supported/FinishingsSupported.java index 26e74522a..f271fa71b 100644 --- a/gnu/javax/print/ipp/attribute/supported/FinishingsSupported.java +++ b/gnu/javax/print/ipp/attribute/supported/FinishingsSupported.java @@ -288,13 +288,13 @@ public final class FinishingsSupported extends EnumSyntax * @see #getAssociatedAttribute() */ public static Finishings[] - getAssociatedAttributeArray(Set<FinishingsSupported> set) + getAssociatedAttributeArray(Set<Attribute> set) { Finishings[] result = new Finishings[set.size()]; int j = 0; - for (FinishingsSupported tmp : set) + for (Attribute tmp : set) { - result[j] = tmp.getAssociatedAttribute(); + result[j] = ((FinishingsSupported) tmp).getAssociatedAttribute(); j++; } return result; diff --git a/gnu/javax/print/ipp/attribute/supported/JobSheetsSupported.java b/gnu/javax/print/ipp/attribute/supported/JobSheetsSupported.java index 8f6f21c58..aeb86ff10 100644 --- a/gnu/javax/print/ipp/attribute/supported/JobSheetsSupported.java +++ b/gnu/javax/print/ipp/attribute/supported/JobSheetsSupported.java @@ -131,13 +131,13 @@ public final class JobSheetsSupported extends TextSyntax * @see #getAssociatedAttribute() */ public static JobSheets[] - getAssociatedAttributeArray(Set<JobSheetsSupported> set) + getAssociatedAttributeArray(Set<Attribute> set) { ArrayList<JobSheets> result = new ArrayList<JobSheets>(); int j = 0; - for (JobSheetsSupported tmp : set) + for (Attribute tmp : set) { - JobSheets att = tmp.getAssociatedAttribute(); + JobSheets att = ((JobSheetsSupported) tmp).getAssociatedAttribute(); if (att != null) result.add(att); j++; diff --git a/gnu/javax/print/ipp/attribute/supported/MediaSupported.java b/gnu/javax/print/ipp/attribute/supported/MediaSupported.java index f0b02d3bc..2684ebbec 100644 --- a/gnu/javax/print/ipp/attribute/supported/MediaSupported.java +++ b/gnu/javax/print/ipp/attribute/supported/MediaSupported.java @@ -100,11 +100,11 @@ public final class MediaSupported extends TextSyntax * @param set set to process * @return The constructed array. */ - public static Media[] getAssociatedAttributeArray(Set<MediaSupported> set) + public static Media[] getAssociatedAttributeArray(Set<Attribute> set) { Media tmp2; ArrayList<Media> result = new ArrayList<Media>(); - for (MediaSupported tmp : set) + for (Attribute tmp : set) { tmp2 = (Media) IppUtilities.getEnumAttribute("media", tmp.toString()); if (tmp2 != null) diff --git a/gnu/javax/print/ipp/attribute/supported/MultipleDocumentHandlingSupported.java b/gnu/javax/print/ipp/attribute/supported/MultipleDocumentHandlingSupported.java index e4c6a1a62..73e5921f1 100644 --- a/gnu/javax/print/ipp/attribute/supported/MultipleDocumentHandlingSupported.java +++ b/gnu/javax/print/ipp/attribute/supported/MultipleDocumentHandlingSupported.java @@ -162,13 +162,13 @@ public final class MultipleDocumentHandlingSupported extends EnumSyntax * @see #getAssociatedAttribute() */ public static MultipleDocumentHandling[] - getAssociatedAttributeArray(Set<MultipleDocumentHandlingSupported> set) + getAssociatedAttributeArray(Set<Attribute> set) { MultipleDocumentHandling[] result = new MultipleDocumentHandling[set.size()]; int j = 0; - for (MultipleDocumentHandlingSupported tmp : set) + for (Attribute tmp : set) { - result[j] = tmp.getAssociatedAttribute(); + result[j] = ((MultipleDocumentHandlingSupported) tmp).getAssociatedAttribute(); j++; } return result; diff --git a/gnu/javax/print/ipp/attribute/supported/OrientationRequestedSupported.java b/gnu/javax/print/ipp/attribute/supported/OrientationRequestedSupported.java index 4e5da3182..4b87c53a5 100644 --- a/gnu/javax/print/ipp/attribute/supported/OrientationRequestedSupported.java +++ b/gnu/javax/print/ipp/attribute/supported/OrientationRequestedSupported.java @@ -164,13 +164,13 @@ public final class OrientationRequestedSupported extends EnumSyntax * @see #getAssociatedAttribute() */ public static OrientationRequested[] - getAssociatedAttributeArray(Set<OrientationRequestedSupported> set) + getAssociatedAttributeArray(Set<Attribute> set) { OrientationRequested[] result = new OrientationRequested[set.size()]; int j = 0; - for (OrientationRequestedSupported tmp : set) + for (Attribute tmp : set) { - result[j] = tmp.getAssociatedAttribute(); + result[j] = ((OrientationRequestedSupported) tmp).getAssociatedAttribute(); j++; } return result; diff --git a/gnu/javax/print/ipp/attribute/supported/PrintQualitySupported.java b/gnu/javax/print/ipp/attribute/supported/PrintQualitySupported.java index 470a869ac..25cbf9f0b 100644 --- a/gnu/javax/print/ipp/attribute/supported/PrintQualitySupported.java +++ b/gnu/javax/print/ipp/attribute/supported/PrintQualitySupported.java @@ -155,13 +155,13 @@ public final class PrintQualitySupported extends EnumSyntax * * @see #getAssociatedAttribute() */ - public static PrintQuality[] getAssociatedAttributeArray(Set<PrintQualitySupported> set) + public static PrintQuality[] getAssociatedAttributeArray(Set<Attribute> set) { PrintQuality[] result = new PrintQuality[set.size()]; int j = 0; - for (PrintQualitySupported tmp : set) + for (Attribute tmp : set) { - result[j] = tmp.getAssociatedAttribute(); + result[j] = ((PrintQualitySupported) tmp).getAssociatedAttribute(); j++; } return result; diff --git a/gnu/javax/print/ipp/attribute/supported/PrinterResolutionSupported.java b/gnu/javax/print/ipp/attribute/supported/PrinterResolutionSupported.java index 0c1210d64..eb50aaac5 100644 --- a/gnu/javax/print/ipp/attribute/supported/PrinterResolutionSupported.java +++ b/gnu/javax/print/ipp/attribute/supported/PrinterResolutionSupported.java @@ -128,13 +128,13 @@ public final class PrinterResolutionSupported extends ResolutionSyntax * @see #getAssociatedAttribute() */ public static PrinterResolution[] - getAssociatedAttributeArray(Set<PrinterResolutionSupported> set) + getAssociatedAttributeArray(Set<Attribute> set) { PrinterResolution[] result = new PrinterResolution[set.size()]; int j = 0; - for (PrinterResolutionSupported tmp : set) + for (Attribute tmp : set) { - result[j] = tmp.getAssociatedAttribute(); + result[j] = ((PrinterResolutionSupported) tmp).getAssociatedAttribute(); j++; } return result; |