No effective change - code cleanup - remove unnecessary boxing

This commit is contained in:
Robin Bygrave
2015-07-31 20:08:30 +12:00
parent ba3b1fea6f
commit 9fe47194ff
34 changed files with 55 additions and 78 deletions
@@ -891,7 +891,7 @@ public final class EntityBeanIntercept implements Serializable {
} else {
return null;
}
return (pcs == null) ? null : new PropertyChangeEvent(owner, getProperty(propertyIndex), Boolean.valueOf(oldValue), Boolean.valueOf(newValue));
return (pcs == null) ? null : new PropertyChangeEvent(owner, getProperty(propertyIndex), oldValue, newValue);
}
/**
@@ -906,7 +906,7 @@ public final class EntityBeanIntercept implements Serializable {
} else {
return null;
}
return (pcs == null) ? null : new PropertyChangeEvent(owner, getProperty(propertyIndex), Integer.valueOf(oldValue), Integer.valueOf(newValue));
return (pcs == null) ? null : new PropertyChangeEvent(owner, getProperty(propertyIndex), oldValue, newValue);
}
/**
@@ -922,7 +922,7 @@ public final class EntityBeanIntercept implements Serializable {
return null;
}
return (pcs == null) ? null : new PropertyChangeEvent(owner, getProperty(propertyIndex), Long.valueOf(oldValue), Long.valueOf(newValue));
return (pcs == null) ? null : new PropertyChangeEvent(owner, getProperty(propertyIndex), oldValue, newValue);
}
/**
@@ -937,7 +937,7 @@ public final class EntityBeanIntercept implements Serializable {
} else {
return null;
}
return (pcs == null) ? null : new PropertyChangeEvent(owner, getProperty(propertyIndex), Double.valueOf(oldValue), Double.valueOf(newValue));
return (pcs == null) ? null : new PropertyChangeEvent(owner, getProperty(propertyIndex), oldValue, newValue);
}
/**
@@ -952,7 +952,7 @@ public final class EntityBeanIntercept implements Serializable {
} else {
return null;
}
return (pcs == null) ? null : new PropertyChangeEvent(owner, getProperty(propertyIndex), Float.valueOf(oldValue), Float.valueOf(newValue));
return (pcs == null) ? null : new PropertyChangeEvent(owner, getProperty(propertyIndex), oldValue, newValue);
}
/**
@@ -967,7 +967,7 @@ public final class EntityBeanIntercept implements Serializable {
} else {
return null;
}
return (pcs == null) ? null : new PropertyChangeEvent(owner, getProperty(propertyIndex), Short.valueOf(oldValue), Short.valueOf(newValue));
return (pcs == null) ? null : new PropertyChangeEvent(owner, getProperty(propertyIndex), oldValue, newValue);
}
/**
@@ -982,7 +982,7 @@ public final class EntityBeanIntercept implements Serializable {
} else {
return null;
}
return (pcs == null) ? null : new PropertyChangeEvent(owner, getProperty(propertyIndex), Character.valueOf(oldValue), Character.valueOf(newValue));
return (pcs == null) ? null : new PropertyChangeEvent(owner, getProperty(propertyIndex), oldValue, newValue);
}
/**
@@ -997,7 +997,7 @@ public final class EntityBeanIntercept implements Serializable {
} else {
return null;
}
return (pcs == null) ? null : new PropertyChangeEvent(owner, getProperty(propertyIndex), Byte.valueOf(oldValue), Byte.valueOf(newValue));
return (pcs == null) ? null : new PropertyChangeEvent(owner, getProperty(propertyIndex), oldValue, newValue);
}
/**
@@ -40,7 +40,7 @@ public class ServerCacheStatistics {
protected long evictByLRU;
public String toString() {
StringBuilder sb = new StringBuilder();
StringBuilder sb = new StringBuilder(80);
sb.append(cacheName);
sb.append(" maxSize:").append(maxSize);
sb.append(" size:").append(size);
@@ -1,7 +1,6 @@
package com.avaje.ebean.common;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
@@ -58,7 +58,7 @@ public class DbTypeMap {
* Override the type for a given JDBC type.
*/
public void put(int jdbcType, DbType dbType) {
typeMap.put(Integer.valueOf(jdbcType), dbType);
typeMap.put(jdbcType, dbType);
}
/**
@@ -66,7 +66,7 @@ public class DbTypeMap {
*/
public DbType get(int jdbcType) {
DbType dbType = typeMap.get(Integer.valueOf(jdbcType));
DbType dbType = typeMap.get(jdbcType);
if (dbType == null) {
String m = "No DB type for JDBC type " + jdbcType;
throw new RuntimeException(m);
@@ -61,8 +61,7 @@ public class SimpleSequenceIdGenerator implements IdGenerator {
pstmt = c.prepareStatement(sql);
rset = pstmt.executeQuery();
if (rset.next()) {
int val = rset.getInt(1);
return Integer.valueOf(val);
return rset.getInt(1);
} else {
String m = "Always expecting 1 row from " + sql;
throw new PersistenceException(m);
@@ -442,7 +442,7 @@ public class DefaultAutoFetchManager implements AutoFetchManager, Serializable {
Boolean autoFetch = query.isAutofetch();
if (autoFetch != null) {
// explicitly set...
return autoFetch.booleanValue();
return autoFetch;
} else {
// determine using implicit mode...
@@ -2,7 +2,6 @@ package com.avaje.ebeaninternal.server.autofetch;
import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -26,7 +26,7 @@ public class TunedQueryInfo implements Serializable {
*/
private int profileCount;
private Long lastTuneTime = Long.valueOf(0);
private Long lastTuneTime = (long) 0;
private final String rateMonitor = new String();
@@ -87,7 +87,7 @@ public class TunedQueryInfo implements Serializable {
public void setTunedDetail(OrmQueryDetail tunedDetail) {
// assignment is atomic
this.tunedDetail = tunedDetail;
this.lastTuneTime = Long.valueOf(System.currentTimeMillis());
this.lastTuneTime = System.currentTimeMillis();
}
/**
@@ -44,9 +44,7 @@ public class CachedBeanData {
*/
public boolean[] copyLoaded() {
boolean[] dest = new boolean[data.length];
for (int i = 0; i < dest.length; i++) {
dest[i] = loaded[i];
}
System.arraycopy(loaded, 0, dest, 0, dest.length);
return dest;
}
@@ -170,7 +170,7 @@ public class IncomingPacketsProcessed {
boolean lostPacket = false;
for (long i = gotAllPoint + 1; i < gotMaxPoint; i++) {
Long packetId = Long.valueOf(i);
Long packetId = i;
if (!outOfOrderList.contains(packetId)) {
if (incrementResendCount(packetId)) {
// request this packet be resent
@@ -195,7 +195,7 @@ public class IncomingPacketsProcessed {
private boolean incrementResendCount(Long packetId){
Integer resendCount = resendCountMap.get(packetId);
if (resendCount != null){
int i = resendCount.intValue() + 1;
int i = resendCount + 1;
if (i > maxResendIncoming){
// we are going to give up trying to get this packet now
logger.warn("Exceeded maxResendIncoming["+maxResendIncoming+"] for packet["+packetId+"]. Giving up on requesting it.");
@@ -203,7 +203,7 @@ public class IncomingPacketsProcessed {
outOfOrderList.add(packetId);
return false;
}
resendCount = Integer.valueOf(i);
resendCount = i;
resendCountMap.put(packetId, resendCount);
} else {
resendCountMap.put(packetId, ONE);
@@ -211,7 +211,7 @@ public class IncomingPacketsProcessed {
return true;
}
private static final Integer ONE = Integer.valueOf(1);
private static final Integer ONE = 1;
public boolean processPacket(long packetId) {
synchronized (this) {
@@ -235,7 +235,7 @@ public class IncomingPacketsProcessed {
if (packetId > gotMaxPoint) {
gotMaxPoint = packetId;
}
outOfOrderList.add(Long.valueOf(packetId));
outOfOrderList.add(packetId);
}
checkOutOfOrderList();
return true;
@@ -256,7 +256,7 @@ public class IncomingPacketsProcessed {
Iterator<Long> it = outOfOrderList.iterator();
while (it.hasNext()) {
Long id = it.next();
if (id.longValue() == nextPoint) {
if (id == nextPoint) {
// we found the next one in the outOfOrderList
it.remove();
gotAllPoint = nextPoint;
@@ -14,7 +14,6 @@ import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.TreeSet;
@@ -37,7 +37,7 @@ public class MessageResend implements Message {
}
public void add(long packetId){
resendPacketIds.add(Long.valueOf(packetId));
resendPacketIds.add(packetId);
}
public List<Long> getResendPacketIds() {
@@ -57,7 +57,7 @@ public class OutgoingPacketsCache {
Iterator<Long> it = packetMap.keySet().iterator();
while (it.hasNext()) {
Long pktId = it.next();
if (minAcked >= pktId.longValue()) {
if (minAcked >= pktId) {
it.remove();
}
}
@@ -223,7 +223,7 @@ public final class BasicTypeConverter implements Serializable {
return (Float) value;
}
if (value instanceof Number) {
return Float.valueOf(((Number) value).floatValue());
return ((Number) value).floatValue();
}
return Float.valueOf(value.toString());
}
@@ -237,7 +237,7 @@ public final class BasicTypeConverter implements Serializable {
return (Short) value;
}
if (value instanceof Number) {
return Short.valueOf(((Number) value).shortValue());
return ((Number) value).shortValue();
}
return Short.valueOf(value.toString());
}
@@ -266,7 +266,7 @@ public final class BasicTypeConverter implements Serializable {
return (Integer) value;
}
if (value instanceof Number) {
return Integer.valueOf(((Number) value).intValue());
return ((Number) value).intValue();
}
return Integer.valueOf(value.toString());
}
@@ -286,13 +286,13 @@ public final class BasicTypeConverter implements Serializable {
return Long.valueOf((String) value);
}
if (value instanceof Number) {
return Long.valueOf(((Number) value).longValue());
return ((Number) value).longValue();
}
if (value instanceof java.util.Date) {
return Long.valueOf(((java.util.Date) value).getTime());
return ((java.util.Date) value).getTime();
}
if (value instanceof Calendar) {
return Long.valueOf(((Calendar) value).getTime().getTime());
return ((Calendar) value).getTime().getTime();
}
return Long.valueOf(value.toString());
}
@@ -320,7 +320,7 @@ public final class BasicTypeConverter implements Serializable {
return (Double) value;
}
if (value instanceof Number) {
return Double.valueOf(((Number) value).doubleValue());
return ((Number) value).doubleValue();
}
return Double.valueOf(value.toString());
}
@@ -308,7 +308,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
if (id != null) {
hc += id.hashCode();
}
beanHash = new Integer(hc);
beanHash = hc;
}
return beanHash;
}
@@ -421,9 +421,7 @@ public class BeanDescriptor<T> implements MetaBeanInfo {
// populate a smaller/minimal array
int[] unload = new int[pos];
for (int i = 0; i < pos; i++) {
unload[i] = props[i];
}
System.arraycopy(props, 0, unload, 0, pos);
return unload;
}
@@ -1,7 +1,6 @@
package com.avaje.ebeaninternal.server.deploy;
import java.io.IOException;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;
@@ -19,8 +19,7 @@ public class GeneratedCounter implements GeneratedProperty {
* Always returns a 1.
*/
public Object getInsertValue(BeanProperty prop, EntityBean bean) {
Integer i = Integer.valueOf(1);
return BasicTypeConverter.convert(i, numberType);
return BasicTypeConverter.convert(1, numberType);
}
/**
@@ -28,7 +27,7 @@ public class GeneratedCounter implements GeneratedProperty {
*/
public Object getUpdateValue(BeanProperty prop, EntityBean bean) {
Number currVal = (Number) prop.getValue(bean);
Integer nextVal = Integer.valueOf(currVal.intValue() + 1);
Integer nextVal = currVal.intValue() + 1;
return BasicTypeConverter.convert(nextVal, numberType);
}
@@ -16,7 +16,7 @@ public class GeneratedCounterInteger implements GeneratedProperty {
* Always returns a 1.
*/
public Object getInsertValue(BeanProperty prop, EntityBean bean) {
return Integer.valueOf(1);
return 1;
}
/**
@@ -24,7 +24,7 @@ public class GeneratedCounterInteger implements GeneratedProperty {
*/
public Object getUpdateValue(BeanProperty prop, EntityBean bean) {
Integer i = (Integer) prop.getValue(bean);
return Integer.valueOf(i.intValue() + 1);
return i.intValue() + 1;
}
/**
@@ -16,7 +16,7 @@ public class GeneratedCounterLong implements GeneratedProperty {
* Always returns a 1.
*/
public Object getInsertValue(BeanProperty prop, EntityBean bean) {
return Long.valueOf(1);
return (long) 1;
}
/**
@@ -24,7 +24,7 @@ public class GeneratedCounterLong implements GeneratedProperty {
*/
public Object getUpdateValue(BeanProperty prop, EntityBean bean) {
Long i = (Long) prop.getValue(bean);
return Long.valueOf(i.longValue() + 1);
return i.longValue() + 1;
}
/**
@@ -12,7 +12,7 @@ public class GeneratedInsertLong implements GeneratedProperty {
* Return the current time as a Timestamp.
*/
public Object getInsertValue(BeanProperty prop, EntityBean bean) {
return Long.valueOf(System.currentTimeMillis());
return System.currentTimeMillis();
}
/**
@@ -12,14 +12,14 @@ public class GeneratedUpdateLong implements GeneratedProperty {
* Return now as a Timestamp.
*/
public Object getInsertValue(BeanProperty prop, EntityBean bean) {
return Long.valueOf(System.currentTimeMillis());
return System.currentTimeMillis();
}
/**
* Return now as a Timestamp.
*/
public Object getUpdateValue(BeanProperty prop, EntityBean bean) {
return Long.valueOf(System.currentTimeMillis());
return System.currentTimeMillis();
}
/**
@@ -194,7 +194,7 @@ public class DeployInheritInfo {
discriminatorStringValue = value;
// convert the value if desired
if (discriminatorType == Types.INTEGER){
this.discriminatorObjectValue = Integer.valueOf(value.toString());
this.discriminatorObjectValue = Integer.valueOf(value);
} else {
this.discriminatorObjectValue = value;
}
@@ -253,11 +253,7 @@ public class DeployInheritInfo {
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("InheritInfo[").append(type.getName()).append("]");
sb.append(" root[").append(parent.getName()).append("]");
sb.append(" disValue[").append(discriminatorStringValue).append("]");
return sb.toString();
return "InheritInfo[" + type.getName() + "]" + " root[" + parent.getName() + "]" + " disValue[" + discriminatorStringValue + "]";
}
}
@@ -100,7 +100,7 @@ public class OraclePstmtBatch implements PstmtBatch {
int rows;
try {
// invoke sendBatch();
rows = ((Integer) METHOD_SEND_BATCH.invoke(pstmtDelegate.unwrap(pstmt))).intValue();
rows = (Integer) METHOD_SEND_BATCH.invoke(pstmtDelegate.unwrap(pstmt));
} catch (IllegalAccessException e) {
String msg = "Error invoking Oracle sendBatch method via reflection";
@@ -263,7 +263,7 @@ public class DataSourcePool implements DataSource {
}
String transIsolation = TransactionIsolation.getLevelDescription(transactionIsolation);
StringBuilder sb = new StringBuilder();
StringBuilder sb = new StringBuilder(70);
sb.append("DataSourcePool [").append(name);
sb.append("] autoCommit[").append(autoCommit);
sb.append("] transIsolation[").append(transIsolation);
@@ -316,9 +316,7 @@ public class Dnode {
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("[").append(getNodeName()).append(" ").append(attrList).append("]");
return sb.toString();
return "[" + getNodeName() + " " + attrList + "]";
}
}
@@ -37,9 +37,7 @@ public class MailAddress {
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getAlias()).append(" ").append("<").append(getEmailAddress()).append(">");
return sb.toString();
return getAlias() + " " + "<" + getEmailAddress() + ">";
}
}
@@ -135,7 +135,7 @@ public class MailMessage {
public String toString() {
StringBuilder sb = new StringBuilder(100);
sb.append("Sender: " + senderAddress + "\tRecipient: " + recipientList + "\n");
sb.append("Sender: ").append(senderAddress ).append("\tRecipient: ").append(recipientList).append("\n");
for (String key : header.keySet()) {
String hline = key + ": " + header.get(key) + "\n";
sb.append(hline);
@@ -124,7 +124,7 @@ public final class UpdateMeta {
}
}
Integer key = Integer.valueOf(hash);
Integer key = hash;
// check if we can use a cached UpdatePlan
SpiUpdatePlan updatePlan = beanDescriptor.getUpdatePlan(key);
@@ -58,7 +58,7 @@ public class UpdatePlan implements SpiUpdatePlan {
*/
private UpdatePlan() {
this.emptySetClause = true;
this.key = Integer.valueOf(0);
this.key = 0;
this.mode = ConcurrencyMode.NONE;
this.sql = null;
this.set = null;
@@ -17,7 +17,7 @@ public class BeanPropertiesReader {
public BeanPropertiesReader(Class<?> clazz) {
this.props = getProperties(clazz);
for (int i=0; i<props.length; i++) {
propertyIndexMap.put(props[i], Integer.valueOf(i));
propertyIndexMap.put(props[i], i);
}
}
@@ -77,7 +77,7 @@ public class CQueryRowCount {
* Return a summary description of this query.
*/
public String getSummary() {
StringBuilder sb = new StringBuilder();
StringBuilder sb = new StringBuilder(80);
sb.append("FindRowCount exeMicros[").append(executionTimeMicros)
.append("] rows[").append(rowCount)
.append("] type[").append(desc.getFullName())
@@ -32,12 +32,7 @@ public class BeanDelta {
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("BeanDelta[");
sb.append(beanDescriptor.getName()).append(":");
sb.append(properties);
sb.append("]");
return sb.toString();
return "BeanDelta[" + beanDescriptor.getName() + ":" + properties + "]";
}
public Object getId() {
@@ -249,7 +249,7 @@ public class JdbcTransaction implements SpiTransaction {
if (derivedRelMap == null) {
derivedRelMap = new HashMap<Integer, List<DerivedRelationshipData>>();
}
Integer key = new Integer(System.identityHashCode(derivedRelationship.getAssocBean()));
Integer key = System.identityHashCode(derivedRelationship.getAssocBean());
List<DerivedRelationshipData> list = derivedRelMap.get(key);
if (list == null) {