[DS-707] Replace inefficient instantiation of boxed primitives.

git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5482 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Mark Wood
2010-10-20 14:24:23 +00:00
parent b67fa3fbed
commit 0bbf324591

View File

@@ -136,35 +136,29 @@ public class Event implements Serializable
private static Map<Integer, Integer> objMaskToType = new HashMap<Integer, Integer>(); private static Map<Integer, Integer> objMaskToType = new HashMap<Integer, Integer>();
static static
{ {
objTypeToMask.put(new Integer(Constants.BITSTREAM), new Integer( objTypeToMask.put(Constants.BITSTREAM, BITSTREAM);
BITSTREAM)); objMaskToType.put(BITSTREAM, Constants.BITSTREAM);
objMaskToType.put(new Integer(BITSTREAM), new Integer(
Constants.BITSTREAM));
objTypeToMask.put(new Integer(Constants.BUNDLE), new Integer(BUNDLE)); objTypeToMask.put(Constants.BUNDLE, BUNDLE);
objMaskToType.put(new Integer(BUNDLE), new Integer(Constants.BUNDLE)); objMaskToType.put(BUNDLE, Constants.BUNDLE);
objTypeToMask.put(new Integer(Constants.ITEM), new Integer(ITEM)); objTypeToMask.put(Constants.ITEM, ITEM);
objMaskToType.put(new Integer(ITEM), new Integer(Constants.ITEM)); objMaskToType.put(ITEM, Constants.ITEM);
objTypeToMask.put(new Integer(Constants.COLLECTION), new Integer( objTypeToMask.put(Constants.COLLECTION, COLLECTION);
COLLECTION)); objMaskToType.put(COLLECTION, Constants.COLLECTION);
objMaskToType.put(new Integer(COLLECTION), new Integer(
Constants.COLLECTION));
objTypeToMask.put(new Integer(Constants.COMMUNITY), new Integer( objTypeToMask.put(Constants.COMMUNITY, COMMUNITY);
COMMUNITY)); objMaskToType.put(COMMUNITY, Constants.COMMUNITY);
objMaskToType.put(new Integer(COMMUNITY), new Integer(
Constants.COMMUNITY));
objTypeToMask.put(new Integer(Constants.SITE), new Integer(SITE)); objTypeToMask.put(Constants.SITE, SITE);
objMaskToType.put(new Integer(SITE), new Integer(Constants.SITE)); objMaskToType.put(SITE, Constants.SITE);
objTypeToMask.put(new Integer(Constants.GROUP), new Integer(GROUP)); objTypeToMask.put(Constants.GROUP, GROUP);
objMaskToType.put(new Integer(GROUP), new Integer(Constants.GROUP)); objMaskToType.put(GROUP, Constants.GROUP);
objTypeToMask.put(new Integer(Constants.EPERSON), new Integer(EPERSON)); objTypeToMask.put(Constants.EPERSON, EPERSON);
objMaskToType.put(new Integer(EPERSON), new Integer(Constants.EPERSON)); objMaskToType.put(EPERSON, Constants.EPERSON);
} }
/** ---------- Event Fields ------------- * */ /** ---------- Event Fields ------------- * */
@@ -298,7 +292,7 @@ public class Event implements Serializable
// translate a "core.Constants" object type value to local bitmask value. // translate a "core.Constants" object type value to local bitmask value.
private static int coreTypeToMask(int core) private static int coreTypeToMask(int core)
{ {
Integer mask = (Integer) objTypeToMask.get(new Integer(core)); Integer mask = objTypeToMask.get(core);
if (mask == null) if (mask == null)
return -1; return -1;
else else
@@ -308,7 +302,7 @@ public class Event implements Serializable
// translate bitmask object-type to "core.Constants" object type. // translate bitmask object-type to "core.Constants" object type.
private static int maskTypeToCore(int mask) private static int maskTypeToCore(int mask)
{ {
Integer core = (Integer) objMaskToType.get(new Integer(mask)); Integer core = objMaskToType.get(mask);
if (core == null) if (core == null)
return -1; return -1;
else else