HHH-5907 change to use autobox instead of create new object everytime to get minor improvement

This commit is contained in:
Strong Liu 2011-02-09 20:20:09 +08:00
parent d9dc1c9125
commit 1479a69fdd
1 changed files with 8 additions and 8 deletions

View File

@ -73,7 +73,7 @@ public class TypeNames {
* @return the default type name associated with specified key * @return the default type name associated with specified key
*/ */
public String get(int typecode) throws MappingException { public String get(int typecode) throws MappingException {
String result = defaults.get( new Integer(typecode) ); String result = defaults.get( typecode );
if (result==null) throw new MappingException("No Dialect mapping for JDBC type: " + typecode); if (result==null) throw new MappingException("No Dialect mapping for JDBC type: " + typecode);
return result; return result;
} }
@ -88,12 +88,12 @@ public class TypeNames {
* if available and the default type name otherwise * if available and the default type name otherwise
*/ */
public String get(int typecode, int size, int precision, int scale) throws MappingException { public String get(int typecode, int size, int precision, int scale) throws MappingException {
Map<Integer, String> map = weighted.get( new Integer(typecode) ); Map<Integer, String> map = weighted.get( typecode );
if ( map!=null && map.size()>0 ) { if ( map!=null && map.size()>0 ) {
// iterate entries ordered by capacity to find first fit // iterate entries ordered by capacity to find first fit
for (Map.Entry<Integer, String> entry: map.entrySet()) { for (Map.Entry<Integer, String> entry: map.entrySet()) {
if ( size <= ( (Integer) entry.getKey() ).intValue() ) { if ( size <= ( entry.getKey() ).intValue() ) {
return replace( (String) entry.getValue(), size, precision, scale ); return replace( entry.getValue(), size, precision, scale );
} }
} }
} }
@ -111,12 +111,12 @@ public class TypeNames {
* @param typecode the type key * @param typecode the type key
*/ */
public void put(int typecode, int capacity, String value) { public void put(int typecode, int capacity, String value) {
Map<Integer, String> map = weighted.get( new Integer(typecode) ); Map<Integer, String> map = weighted.get( typecode );
if (map == null) {// add new ordered map if (map == null) {// add new ordered map
map = new TreeMap<Integer, String>(); map = new TreeMap<Integer, String>();
weighted.put( new Integer(typecode), map ); weighted.put( typecode, map );
} }
map.put(new Integer(capacity), value); map.put(capacity, value);
} }
/** /**
@ -124,7 +124,7 @@ public class TypeNames {
* @param typecode the type key * @param typecode the type key
*/ */
public void put(int typecode, String value) { public void put(int typecode, String value) {
defaults.put( new Integer(typecode), value ); defaults.put( typecode, value );
} }
} }