aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas L. Delmelle <adelmelle@apache.org>2011-01-22 19:15:11 +0000
committerAndreas L. Delmelle <adelmelle@apache.org>2011-01-22 19:15:11 +0000
commit881ef26a95f595c6606bb73a5853b81885b13cd1 (patch)
tree906c75c1c31d4fc61521254a6510d337f2e09abd
parentb970c338ba74b78e16b10c0b38b71b33df49fb36 (diff)
downloadxmlgraphics-fop-881ef26a95f595c6606bb73a5853b81885b13cd1.tar.gz
xmlgraphics-fop-881ef26a95f595c6606bb73a5853b81885b13cd1.zip
Make HashMaps type safe + remove corresponding redundant casts and unnecessary (un)boxing
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1062241 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/fo/FOPropertyMapping.java31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/java/org/apache/fop/fo/FOPropertyMapping.java b/src/java/org/apache/fop/fo/FOPropertyMapping.java
index c711a76c0..1aaa23bd6 100644
--- a/src/java/org/apache/fop/fo/FOPropertyMapping.java
+++ b/src/java/org/apache/fop/fo/FOPropertyMapping.java
@@ -79,9 +79,12 @@ public final class FOPropertyMapping implements Constants {
private FOPropertyMapping() {
}
- private static Map propNames = new HashMap(); // CSOK: VisibilityModifier
- private static Map subPropNames = new HashMap(); // CSOK: VisibilityModifier
- private static Map propIds = new HashMap(); // CSOK: VisibilityModifier
+ private static Map<String, Integer> propNames
+ = new HashMap<String, Integer>(); // CSOK: VisibilityModifier
+ private static Map<String, Integer> subPropNames
+ = new HashMap<String, Integer>(); // CSOK: VisibilityModifier
+ private static Map<Integer, String> propIds
+ = new HashMap<Integer, String>(); // CSOK: VisibilityModifier
private static PropertyMaker[] generics = null; // CSOK: VisibilityModifier
@@ -246,8 +249,8 @@ public final class FOPropertyMapping implements Constants {
*/
private static void addPropertyMaker(String name, PropertyMaker maker) {
generics[maker.getPropId()] = maker;
- propNames.put(name, new Integer(maker.getPropId()));
- propIds.put(new Integer(maker.getPropId()), name);
+ propNames.put(name, maker.getPropId());
+ propIds.put(maker.getPropId(), name);
}
/**
@@ -256,8 +259,8 @@ public final class FOPropertyMapping implements Constants {
* @param id Id for the subproperty from CP_* in Constants.java.
*/
private static void addSubpropMakerName(String name, int id) {
- subPropNames.put(name, new Integer(id));
- propIds.put(new Integer(id), name);
+ subPropNames.put(name, id);
+ propIds.put(id, name);
}
/**
@@ -342,9 +345,9 @@ public final class FOPropertyMapping implements Constants {
*/
public static int getPropertyId(String name) {
if (name != null) {
- Integer i = (Integer) propNames.get(name);
+ Integer i = propNames.get(name);
if (i != null) {
- return i.intValue();
+ return i;
}
}
return -1;
@@ -357,9 +360,9 @@ public final class FOPropertyMapping implements Constants {
*/
public static int getSubPropertyId(String name) {
if (name != null) {
- Integer i = (Integer) subPropNames.get(name);
+ Integer i = subPropNames.get(name);
if (i != null) {
- return i.intValue();
+ return i;
}
}
return -1;
@@ -373,10 +376,10 @@ public final class FOPropertyMapping implements Constants {
public static String getPropertyName(int id) {
if (((id & Constants.COMPOUND_MASK) == 0)
|| ((id & Constants.PROPERTY_MASK) == 0)) {
- return (String) propIds.get(new Integer(id));
+ return propIds.get(id);
} else {
- return propIds.get(new Integer(id & Constants.PROPERTY_MASK))
- + "." + propIds.get(new Integer(id & Constants.COMPOUND_MASK));
+ return propIds.get(id & Constants.PROPERTY_MASK)
+ + "." + propIds.get(id & Constants.COMPOUND_MASK);
}
}