diff options
author | Simon Pepping <spepping@apache.org> | 2011-01-04 13:36:10 +0000 |
---|---|---|
committer | Simon Pepping <spepping@apache.org> | 2011-01-04 13:36:10 +0000 |
commit | 7c5be87cdb9d68effe8e968773b9159f02db06d1 (patch) | |
tree | 3f28aeb15b6de2730b08d86ba34f5f6ee0a5d4f0 /src/java/org/apache/fop/fo | |
parent | e058f4d959c3135516348affa098598fd835da50 (diff) | |
download | xmlgraphics-fop-7c5be87cdb9d68effe8e968773b9159f02db06d1.tar.gz xmlgraphics-fop-7c5be87cdb9d68effe8e968773b9159f02db06d1.zip |
Add type-safe parameters to collections; replace XGC jar to benefit from new type-safe methods
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1055034 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/fo')
10 files changed, 24 insertions, 22 deletions
diff --git a/src/java/org/apache/fop/fo/ElementMapping.java b/src/java/org/apache/fop/fo/ElementMapping.java index 1651f23a6..5417586e0 100644 --- a/src/java/org/apache/fop/fo/ElementMapping.java +++ b/src/java/org/apache/fop/fo/ElementMapping.java @@ -19,7 +19,7 @@ package org.apache.fop.fo; -import java.util.HashMap; +import java.util.Map; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; @@ -30,7 +30,7 @@ import org.apache.xmlgraphics.util.QName; /** * Abstract base class for Element Mappings (including FO Element Mappings) - * which provide the framework of valid elements and attibutes for a given + * which provide the framework of valid elements and attributes for a given * namespace. */ public abstract class ElementMapping { @@ -38,7 +38,7 @@ public abstract class ElementMapping { public static final String DEFAULT = "<default>"; /** The HashMap table of formatting objects defined by the ElementMapping */ - protected HashMap foObjs = null; + protected Map<String, Maker> foObjs = null; //Please don't change that to java.util.Map as that can break extensions. /** The namespace for the ElementMapping */ @@ -49,7 +49,7 @@ public abstract class ElementMapping { * * @return Table of Maker objects for this ElementMapping */ - public HashMap getTable() { + public Map<String, Maker> getTable() { if (foObjs == null) { initialize(); } diff --git a/src/java/org/apache/fop/fo/ElementMappingRegistry.java b/src/java/org/apache/fop/fo/ElementMappingRegistry.java index 4a6904f73..cf14fa281 100644 --- a/src/java/org/apache/fop/fo/ElementMappingRegistry.java +++ b/src/java/org/apache/fop/fo/ElementMappingRegistry.java @@ -48,12 +48,14 @@ public class ElementMappingRegistry { * Table mapping element names to the makers of objects * representing formatting objects. */ - protected Map fobjTable = new java.util.HashMap(); + protected Map<String, Map<String, Maker>> fobjTable + = new java.util.HashMap<String, Map<String, Maker>>(); /** * Map of mapped namespaces and their associated ElementMapping instances. */ - protected Map namespaces = new java.util.HashMap(); + protected Map<String, ElementMapping> namespaces + = new java.util.HashMap<String, ElementMapping>(); /** * Main constructor. Adds all default element mapping as well as detects ElementMapping @@ -70,10 +72,10 @@ public class ElementMappingRegistry { */ private void setupDefaultMappings() { // add mappings from available services - Iterator providers = Service.providers(ElementMapping.class, false); + Iterator<String> providers = Service.providerNames(ElementMapping.class); if (providers != null) { while (providers.hasNext()) { - String mapping = (String)providers.next(); + String mapping = providers.next(); try { addElementMapping(mapping); } catch (IllegalArgumentException e) { @@ -129,13 +131,13 @@ public class ElementMappingRegistry { */ public Maker findFOMaker(String namespaceURI, String localName, Locator locator) throws FOPException { - Map table = (Map)fobjTable.get(namespaceURI); + Map<String, Maker> table = fobjTable.get(namespaceURI); Maker fobjMaker = null; if (table != null) { - fobjMaker = (Maker)table.get(localName); + fobjMaker = table.get(localName); // try default if (fobjMaker == null) { - fobjMaker = (Maker)table.get(ElementMapping.DEFAULT); + fobjMaker = table.get(ElementMapping.DEFAULT); } } diff --git a/src/java/org/apache/fop/fo/FOElementMapping.java b/src/java/org/apache/fop/fo/FOElementMapping.java index 0a7e40955..8069880c6 100644 --- a/src/java/org/apache/fop/fo/FOElementMapping.java +++ b/src/java/org/apache/fop/fo/FOElementMapping.java @@ -44,7 +44,7 @@ public class FOElementMapping extends ElementMapping { */ protected void initialize() { if (foObjs == null) { - foObjs = new HashMap(); + foObjs = new HashMap<String, Maker>(); // Declarations and Pagination and Layout Formatting Objects foObjs.put("root", new RootMaker()); diff --git a/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java b/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java index a12bed0fa..80a569c90 100644 --- a/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java +++ b/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java @@ -37,8 +37,8 @@ public class ExtensionElementMapping extends ElementMapping { /** The FOP extension namespace URI */ public static final String URI = "http://xmlgraphics.apache.org/fop/extensions"; - private static final Set PROPERTY_ATTRIBUTES - = new java.util.HashSet(); + private static final Set<String> PROPERTY_ATTRIBUTES + = new java.util.HashSet<String>(); static { //These are FOP's standard extension properties (fox:*) @@ -63,7 +63,7 @@ public class ExtensionElementMapping extends ElementMapping { */ protected void initialize() { if (foObjs == null) { - foObjs = new HashMap(); + foObjs = new HashMap<String, Maker>(); foObjs.put("outline", new UnknownXMLObj.Maker(URI)); foObjs.put("label", new UnknownXMLObj.Maker(URI)); foObjs.put("destination", new DestinationMaker()); diff --git a/src/java/org/apache/fop/fo/extensions/InternalElementMapping.java b/src/java/org/apache/fop/fo/extensions/InternalElementMapping.java index 7704c8de7..4798f5500 100644 --- a/src/java/org/apache/fop/fo/extensions/InternalElementMapping.java +++ b/src/java/org/apache/fop/fo/extensions/InternalElementMapping.java @@ -34,7 +34,7 @@ public class InternalElementMapping extends ElementMapping { /** The FOP extension namespace URI */ public static final String URI = "http://xmlgraphics.apache.org/fop/internal"; - private static final Set PROPERTY_ATTRIBUTES = new java.util.HashSet(); + private static final Set<String> PROPERTY_ATTRIBUTES = new java.util.HashSet<String>(); static { //These are FOP's extension properties for accessibility @@ -53,7 +53,7 @@ public class InternalElementMapping extends ElementMapping { */ protected void initialize() { if (foObjs == null) { - foObjs = new HashMap(); + foObjs = new HashMap<String, Maker>(); } } diff --git a/src/java/org/apache/fop/fo/extensions/OldExtensionElementMapping.java b/src/java/org/apache/fop/fo/extensions/OldExtensionElementMapping.java index e5ab93c35..d1c671dbe 100644 --- a/src/java/org/apache/fop/fo/extensions/OldExtensionElementMapping.java +++ b/src/java/org/apache/fop/fo/extensions/OldExtensionElementMapping.java @@ -44,7 +44,7 @@ public class OldExtensionElementMapping extends ElementMapping { */ protected void initialize() { if (foObjs == null) { - foObjs = new HashMap(); + foObjs = new HashMap<String, Maker>(); foObjs.put("outline", new UnknownXMLObj.Maker(URI)); foObjs.put("label", new UnknownXMLObj.Maker(URI)); } diff --git a/src/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java b/src/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java index 449258525..6103345cf 100644 --- a/src/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java +++ b/src/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java @@ -73,7 +73,7 @@ public class BatikExtensionElementMapping extends ElementMapping { XMLResourceDescriptor.setXMLParserClassName( getAParserClassName()); - foObjs = new HashMap(); + foObjs = new HashMap<String, Maker>(); foObjs.put("batik", new SE()); foObjs.put(DEFAULT, new SVGMaker()); } catch (Throwable t) { diff --git a/src/java/org/apache/fop/fo/extensions/svg/SVGElementMapping.java b/src/java/org/apache/fop/fo/extensions/svg/SVGElementMapping.java index 167baf723..7120dbb59 100644 --- a/src/java/org/apache/fop/fo/extensions/svg/SVGElementMapping.java +++ b/src/java/org/apache/fop/fo/extensions/svg/SVGElementMapping.java @@ -80,7 +80,7 @@ public class SVGElementMapping extends ElementMapping { XMLResourceDescriptor.setXMLParserClassName( getAParserClassName()); - foObjs = new HashMap(); + foObjs = new HashMap<String, Maker>(); foObjs.put("svg", new SE()); foObjs.put(DEFAULT, new SVGMaker()); } catch (Throwable t) { diff --git a/src/java/org/apache/fop/fo/extensions/xmp/RDFElementMapping.java b/src/java/org/apache/fop/fo/extensions/xmp/RDFElementMapping.java index ff84ee11f..a6befd710 100644 --- a/src/java/org/apache/fop/fo/extensions/xmp/RDFElementMapping.java +++ b/src/java/org/apache/fop/fo/extensions/xmp/RDFElementMapping.java @@ -45,7 +45,7 @@ public class RDFElementMapping extends ElementMapping { /** {@inheritDoc} */ protected void initialize() { if (foObjs == null) { - foObjs = new HashMap(); + foObjs = new HashMap<String, Maker>(); foObjs.put("RDF", new RDFElementMaker()); } } diff --git a/src/java/org/apache/fop/fo/extensions/xmp/XMPElementMapping.java b/src/java/org/apache/fop/fo/extensions/xmp/XMPElementMapping.java index b2b3570f2..d934dc2b1 100644 --- a/src/java/org/apache/fop/fo/extensions/xmp/XMPElementMapping.java +++ b/src/java/org/apache/fop/fo/extensions/xmp/XMPElementMapping.java @@ -45,7 +45,7 @@ public class XMPElementMapping extends ElementMapping { /** {@inheritDoc} */ protected void initialize() { if (foObjs == null) { - foObjs = new HashMap(); + foObjs = new HashMap<String, Maker>(); foObjs.put("xmpmeta", new XMPMetaElementMaker()); } } |