HHH-6791 tiny improvement, in favor of java auto-box instead of create new instance
This commit is contained in:
parent
388ceaf186
commit
bec88716d6
|
@ -212,8 +212,8 @@ public class C3P0ConnectionProvider implements ConnectionProvider, Configurable,
|
|||
String i = (String) props.get( Environment.ISOLATION );
|
||||
if (i == null) isolation = null;
|
||||
else {
|
||||
isolation = new Integer( i );
|
||||
LOG.jdbcIsolationLevel(Environment.isolationLevelToString(isolation.intValue()));
|
||||
isolation = Integer.valueOf( i );
|
||||
LOG.jdbcIsolationLevel(Environment.isolationLevelToString(isolation));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public final class FieldInterceptorImpl extends AbstractFieldInterceptor impleme
|
|||
// FieldHandler impl ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
public boolean readBoolean(Object target, String name, boolean oldValue) {
|
||||
return ( ( Boolean ) intercept( target, name, oldValue ? Boolean.TRUE : Boolean.FALSE ) )
|
||||
return ( ( Boolean ) intercept( target, name, oldValue ) )
|
||||
.booleanValue();
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ public final class FieldInterceptorImpl extends AbstractFieldInterceptor impleme
|
|||
|
||||
public boolean writeBoolean(Object target, String name, boolean oldValue, boolean newValue) {
|
||||
dirty();
|
||||
intercept( target, name, oldValue ? Boolean.TRUE : Boolean.FALSE );
|
||||
intercept( target, name, oldValue );
|
||||
return newValue;
|
||||
}
|
||||
|
||||
|
|
|
@ -118,10 +118,10 @@ public class ProxyFactoryFactoryImpl implements ProxyFactoryFactory {
|
|||
return proxiedClassName + "@" + System.identityHashCode( object );
|
||||
}
|
||||
else if ( "equals".equals( name ) ) {
|
||||
return proxiedObject == object ? Boolean.TRUE : Boolean.FALSE;
|
||||
return proxiedObject == object;
|
||||
}
|
||||
else if ( "hashCode".equals( name ) ) {
|
||||
return new Integer( System.identityHashCode( object ) );
|
||||
return System.identityHashCode( object );
|
||||
}
|
||||
boolean hasGetterSignature = method.getParameterTypes().length == 0 && method.getReturnType() != null;
|
||||
boolean hasSetterSignature = method.getParameterTypes().length == 1 && ( method.getReturnType() == null || method.getReturnType() == void.class );
|
||||
|
|
|
@ -91,7 +91,7 @@ public class StandardQueryCache implements QueryCache {
|
|||
boolean isNaturalKeyLookup,
|
||||
SessionImplementor session) throws HibernateException {
|
||||
if (isNaturalKeyLookup && result.size() == 0) return false;
|
||||
Long ts = new Long(session.getFactory().getSettings().getRegionFactory().nextTimestamp());
|
||||
Long ts = session.getFactory().getSettings().getRegionFactory().nextTimestamp();
|
||||
|
||||
LOG.debugf( "Caching query results in region: %s; timestamp=%s", cacheRegion.getName(), ts );
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ public class UpdateTimestampsCache {
|
|||
readWriteLock.writeLock().lock();
|
||||
|
||||
try {
|
||||
Long ts = new Long( region.nextTimestamp() + region.getTimeout() );
|
||||
Long ts = region.nextTimestamp() + region.getTimeout();
|
||||
for ( Serializable space : spaces ) {
|
||||
LOG.debugf( "Pre-invalidating space [%s]", space );
|
||||
//put() has nowait semantics, is this really appropriate?
|
||||
|
@ -94,7 +94,7 @@ public class UpdateTimestampsCache {
|
|||
readWriteLock.writeLock().lock();
|
||||
|
||||
try {
|
||||
Long ts = new Long( region.nextTimestamp() );
|
||||
Long ts = region.nextTimestamp();
|
||||
for (Serializable space : spaces) {
|
||||
LOG.debugf( "Invalidating space [%s], timestamp: %s", space, ts );
|
||||
//put() has nowait semantics, is this really appropriate?
|
||||
|
|
|
@ -61,7 +61,7 @@ public class StructuredCacheEntry implements CacheEntryStructure {
|
|||
Map map = new HashMap(names.length+2);
|
||||
map.put( "_subclass", entry.getSubclass() );
|
||||
map.put( "_version", entry.getVersion() );
|
||||
map.put( "_lazyPropertiesUnfetched", entry.areLazyPropertiesUnfetched() ? Boolean.TRUE : Boolean.FALSE );
|
||||
map.put( "_lazyPropertiesUnfetched", entry.areLazyPropertiesUnfetched() );
|
||||
for ( int i=0; i<names.length; i++ ) {
|
||||
map.put( names[i], entry.getDisassembledState()[i] );
|
||||
}
|
||||
|
|
|
@ -2643,9 +2643,9 @@ public final class HbmBinder {
|
|||
boolean cacheable = "true".equals( queryElem.attributeValue( "cacheable" ) );
|
||||
String region = queryElem.attributeValue( "cache-region" );
|
||||
Attribute tAtt = queryElem.attribute( "timeout" );
|
||||
Integer timeout = tAtt == null ? null : new Integer( tAtt.getValue() );
|
||||
Integer timeout = tAtt == null ? null : Integer.valueOf( tAtt.getValue() );
|
||||
Attribute fsAtt = queryElem.attribute( "fetch-size" );
|
||||
Integer fetchSize = fsAtt == null ? null : new Integer( fsAtt.getValue() );
|
||||
Integer fetchSize = fsAtt == null ? null : Integer.valueOf( fsAtt.getValue() );
|
||||
Attribute roAttr = queryElem.attribute( "read-only" );
|
||||
boolean readOnly = roAttr != null && "true".equals( roAttr.getValue() );
|
||||
Attribute cacheModeAtt = queryElem.attribute( "cache-mode" );
|
||||
|
|
|
@ -62,9 +62,9 @@ public class NamedSQLQuerySecondPass extends ResultSetMappingBinder implements Q
|
|||
boolean cacheable = "true".equals( queryElem.attributeValue( "cacheable" ) );
|
||||
String region = queryElem.attributeValue( "cache-region" );
|
||||
Attribute tAtt = queryElem.attribute( "timeout" );
|
||||
Integer timeout = tAtt == null ? null : new Integer( tAtt.getValue() );
|
||||
Integer timeout = tAtt == null ? null : Integer.valueOf( tAtt.getValue() );
|
||||
Attribute fsAtt = queryElem.attribute( "fetch-size" );
|
||||
Integer fetchSize = fsAtt == null ? null : new Integer( fsAtt.getValue() );
|
||||
Integer fetchSize = fsAtt == null ? null : Integer.valueOf( fsAtt.getValue() );
|
||||
Attribute roAttr = queryElem.attribute( "read-only" );
|
||||
boolean readOnly = roAttr != null && "true".equals( roAttr.getValue() );
|
||||
Attribute cacheModeAtt = queryElem.attribute( "cache-mode" );
|
||||
|
|
|
@ -211,14 +211,14 @@ public class PersistentArrayHolder extends AbstractPersistentCollection {
|
|||
int arraySize = Array.getLength(array);
|
||||
int end;
|
||||
if ( snSize > arraySize ) {
|
||||
for ( int i=arraySize; i<snSize; i++ ) deletes.add( new Integer(i) );
|
||||
for ( int i=arraySize; i<snSize; i++ ) deletes.add( i );
|
||||
end = arraySize;
|
||||
}
|
||||
else {
|
||||
end = snSize;
|
||||
}
|
||||
for ( int i=0; i<end; i++ ) {
|
||||
if ( Array.get(array, i)==null && Array.get(sn, i)!=null ) deletes.add( new Integer(i) );
|
||||
if ( Array.get(array, i)==null && Array.get(sn, i)!=null ) deletes.add( i );
|
||||
}
|
||||
return deletes.iterator();
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ public class PersistentArrayHolder extends AbstractPersistentCollection {
|
|||
}
|
||||
|
||||
public Object getIndex(Object entry, int i, CollectionPersister persister) {
|
||||
return new Integer(i);
|
||||
return i;
|
||||
}
|
||||
|
||||
public Object getElement(Object entry) {
|
||||
|
|
|
@ -87,7 +87,7 @@ public class PersistentIdentifierBag extends AbstractPersistentCollection implem
|
|||
beforeInitialize( persister, size );
|
||||
for ( int i = 0; i < size; i+=2 ) {
|
||||
identifiers.put(
|
||||
new Integer(i/2),
|
||||
(i/2),
|
||||
persister.getIdentifierType().assemble( array[i], getSession(), owner )
|
||||
);
|
||||
values.add( persister.getElementType().assemble( array[i+1], getSession(), owner ) );
|
||||
|
@ -95,7 +95,7 @@ public class PersistentIdentifierBag extends AbstractPersistentCollection implem
|
|||
}
|
||||
|
||||
public Object getIdentifier(Object entry, int i) {
|
||||
return identifiers.get( new Integer(i) );
|
||||
return identifiers.get( i );
|
||||
}
|
||||
|
||||
public boolean isWrapper(Object collection) {
|
||||
|
@ -200,7 +200,7 @@ public class PersistentIdentifierBag extends AbstractPersistentCollection implem
|
|||
int i=0;
|
||||
for (int j=0; j< values.size(); j++) {
|
||||
Object value = values.get(j);
|
||||
result[i++] = persister.getIdentifierType().disassemble( identifiers.get( new Integer(j) ), getSession(), null );
|
||||
result[i++] = persister.getIdentifierType().disassemble( identifiers.get( j ), getSession(), null );
|
||||
result[i++] = persister.getElementType().disassemble( value, getSession(), null );
|
||||
}
|
||||
return result;
|
||||
|
@ -224,7 +224,7 @@ public class PersistentIdentifierBag extends AbstractPersistentCollection implem
|
|||
if ( snap.size()!= values.size() ) return false;
|
||||
for ( int i=0; i<values.size(); i++ ) {
|
||||
Object value = values.get(i);
|
||||
Object id = identifiers.get( new Integer(i) );
|
||||
Object id = identifiers.get( i );
|
||||
if (id==null) return false;
|
||||
Object old = snap.get(id);
|
||||
if ( elementType.isDirty( old, value, getSession() ) ) return false;
|
||||
|
@ -240,7 +240,7 @@ public class PersistentIdentifierBag extends AbstractPersistentCollection implem
|
|||
Map snap = (Map) getSnapshot();
|
||||
List deletes = new ArrayList( snap.keySet() );
|
||||
for ( int i=0; i<values.size(); i++ ) {
|
||||
if ( values.get(i)!=null ) deletes.remove( identifiers.get( new Integer(i) ) );
|
||||
if ( values.get(i)!=null ) deletes.remove( identifiers.get( i ) );
|
||||
}
|
||||
return deletes.iterator();
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ public class PersistentIdentifierBag extends AbstractPersistentCollection implem
|
|||
|
||||
public Object getSnapshotElement(Object entry, int i) {
|
||||
Map snap = (Map) getSnapshot();
|
||||
Object id = identifiers.get( new Integer(i) );
|
||||
Object id = identifiers.get( i );
|
||||
return snap.get(id);
|
||||
}
|
||||
|
||||
|
@ -263,7 +263,7 @@ public class PersistentIdentifierBag extends AbstractPersistentCollection implem
|
|||
throws HibernateException {
|
||||
|
||||
Map snap = (Map) getSnapshot();
|
||||
Object id = identifiers.get( new Integer(i) );
|
||||
Object id = identifiers.get( i );
|
||||
return entry!=null && ( id==null || snap.get(id)==null );
|
||||
}
|
||||
|
||||
|
@ -271,7 +271,7 @@ public class PersistentIdentifierBag extends AbstractPersistentCollection implem
|
|||
|
||||
if (entry==null) return false;
|
||||
Map snap = (Map) getSnapshot();
|
||||
Object id = identifiers.get( new Integer(i) );
|
||||
Object id = identifiers.get( i );
|
||||
if (id==null) return false;
|
||||
Object old = snap.get(id);
|
||||
return old!=null && elemType.isDirty( old, entry, getSession() );
|
||||
|
@ -287,7 +287,7 @@ public class PersistentIdentifierBag extends AbstractPersistentCollection implem
|
|||
|
||||
Object element = persister.readElement( rs, owner, descriptor.getSuffixedElementAliases(), getSession() );
|
||||
Object old = identifiers.put(
|
||||
new Integer( values.size() ),
|
||||
values.size(),
|
||||
persister.readIdentifier( rs, descriptor.getSuffixedIdentifierAlias(), getSession() )
|
||||
);
|
||||
if ( old==null ) values.add(element); //maintain correct duplication if loaded in a cartesian product
|
||||
|
@ -301,7 +301,7 @@ public class PersistentIdentifierBag extends AbstractPersistentCollection implem
|
|||
while ( iter.hasNext() ) {
|
||||
Object value = iter.next();
|
||||
map.put(
|
||||
identifiers.get( new Integer(i++) ),
|
||||
identifiers.get( i++ ),
|
||||
persister.getElementType().deepCopy(value, persister.getFactory())
|
||||
);
|
||||
}
|
||||
|
@ -318,7 +318,7 @@ public class PersistentIdentifierBag extends AbstractPersistentCollection implem
|
|||
int i=0;
|
||||
while ( iter.hasNext() ) {
|
||||
Object entry = iter.next();
|
||||
Integer loc = new Integer(i++);
|
||||
Integer loc = i++;
|
||||
if ( !identifiers.containsKey(loc) ) { //TODO: native ids
|
||||
Serializable id = persister.getIdentifierGenerator().generate( getSession(), entry );
|
||||
identifiers.put(loc, id);
|
||||
|
@ -371,25 +371,25 @@ public class PersistentIdentifierBag extends AbstractPersistentCollection implem
|
|||
}
|
||||
|
||||
private void beforeRemove(int index) {
|
||||
Object removedId = identifiers.get( new Integer(index) );
|
||||
Object removedId = identifiers.get( index );
|
||||
int last = values.size()-1;
|
||||
for ( int i=index; i<last; i++ ) {
|
||||
Object id = identifiers.get( new Integer(i+1) );
|
||||
Object id = identifiers.get( i+1 );
|
||||
if ( id==null ) {
|
||||
identifiers.remove( new Integer(i) );
|
||||
identifiers.remove( i );
|
||||
}
|
||||
else {
|
||||
identifiers.put( new Integer(i), id );
|
||||
identifiers.put( i, id );
|
||||
}
|
||||
}
|
||||
identifiers.put( new Integer(last), removedId );
|
||||
identifiers.put( last, removedId );
|
||||
}
|
||||
|
||||
private void beforeAdd(int index) {
|
||||
for ( int i=index; i<values.size(); i++ ) {
|
||||
identifiers.put( new Integer(i+1), identifiers.get( new Integer(i) ) );
|
||||
identifiers.put( i+1, identifiers.get( i ) );
|
||||
}
|
||||
identifiers.remove( new Integer(index) );
|
||||
identifiers.remove( index );
|
||||
}
|
||||
|
||||
public Object remove(int index) {
|
||||
|
|
|
@ -290,7 +290,7 @@ public class PersistentList extends AbstractPersistentCollection implements List
|
|||
if (index<0) {
|
||||
throw new ArrayIndexOutOfBoundsException("negative index");
|
||||
}
|
||||
Object result = readElementByIndex( new Integer(index) );
|
||||
Object result = readElementByIndex( index );
|
||||
return result==UNKNOWN ? list.get(index) : result;
|
||||
}
|
||||
|
||||
|
@ -301,7 +301,7 @@ public class PersistentList extends AbstractPersistentCollection implements List
|
|||
if (index<0) {
|
||||
throw new ArrayIndexOutOfBoundsException("negative index");
|
||||
}
|
||||
Object old = isPutQueueEnabled() ? readElementByIndex( new Integer(index) ) : UNKNOWN;
|
||||
Object old = isPutQueueEnabled() ? readElementByIndex( index ) : UNKNOWN;
|
||||
if ( old==UNKNOWN ) {
|
||||
write();
|
||||
return list.set(index, value);
|
||||
|
@ -336,7 +336,7 @@ public class PersistentList extends AbstractPersistentCollection implements List
|
|||
throw new ArrayIndexOutOfBoundsException("negative index");
|
||||
}
|
||||
Object old = isPutQueueEnabled() ?
|
||||
readElementByIndex( new Integer(index) ) : UNKNOWN;
|
||||
readElementByIndex( index ) : UNKNOWN;
|
||||
if ( old==UNKNOWN ) {
|
||||
write();
|
||||
return list.remove(index);
|
||||
|
@ -442,7 +442,7 @@ public class PersistentList extends AbstractPersistentCollection implements List
|
|||
int end;
|
||||
if ( sn.size() > list.size() ) {
|
||||
for ( int i=list.size(); i<sn.size(); i++ ) {
|
||||
deletes.add( indexIsFormula ? sn.get(i) : new Integer(i) );
|
||||
deletes.add( indexIsFormula ? sn.get(i) : i );
|
||||
}
|
||||
end = list.size();
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ public class PersistentList extends AbstractPersistentCollection implements List
|
|||
}
|
||||
for ( int i=0; i<end; i++ ) {
|
||||
if ( list.get(i)==null && sn.get(i)!=null ) {
|
||||
deletes.add( indexIsFormula ? sn.get(i) : new Integer(i) );
|
||||
deletes.add( indexIsFormula ? sn.get(i) : i );
|
||||
}
|
||||
}
|
||||
return deletes.iterator();
|
||||
|
@ -469,7 +469,7 @@ public class PersistentList extends AbstractPersistentCollection implements List
|
|||
}
|
||||
|
||||
public Object getIndex(Object entry, int i, CollectionPersister persister) {
|
||||
return new Integer(i);
|
||||
return i;
|
||||
}
|
||||
|
||||
public Object getElement(Object entry) {
|
||||
|
|
|
@ -147,7 +147,7 @@ public class BlobProxy implements InvocationHandler {
|
|||
return Boolean.valueOf( proxy == args[0] );
|
||||
}
|
||||
if ( "hashCode".equals( methodName ) && argCount == 0 ) {
|
||||
return new Integer( this.hashCode() );
|
||||
return this.hashCode();
|
||||
}
|
||||
|
||||
throw new UnsupportedOperationException( "Blob may not be manipulated from creating session" );
|
||||
|
|
|
@ -162,7 +162,7 @@ public class ClobProxy implements InvocationHandler {
|
|||
return Boolean.valueOf( proxy == args[0] );
|
||||
}
|
||||
if ( "hashCode".equals( methodName ) && argCount == 0 ) {
|
||||
return new Integer( this.hashCode() );
|
||||
return this.hashCode();
|
||||
}
|
||||
|
||||
throw new UnsupportedOperationException( "Clob may not be manipulated from creating session" );
|
||||
|
|
|
@ -104,7 +104,7 @@ public class ParameterParser {
|
|||
String param = sqlString.substring( indx + 1, chopLocation );
|
||||
// make sure this "name" is an integral
|
||||
try {
|
||||
new Integer( param );
|
||||
Integer.valueOf( param );
|
||||
}
|
||||
catch( NumberFormatException e ) {
|
||||
throw new QueryException( "JPA-style positional param was not an integral ordinal" );
|
||||
|
|
|
@ -265,7 +265,7 @@ public class QueryPlanCache implements Serializable {
|
|||
final String key = (String) entry.getKey();
|
||||
final Integer valueCount;
|
||||
if ( Collection.class.isInstance( entry.getValue() ) ) {
|
||||
valueCount = new Integer( ( (Collection) entry.getValue() ).size() );
|
||||
valueCount = ( (Collection) entry.getValue() ).size();
|
||||
}
|
||||
else {
|
||||
valueCount = 1;
|
||||
|
|
|
@ -42,7 +42,7 @@ public class BooleanLiteralNode extends LiteralNode implements ExpectedTypeAware
|
|||
}
|
||||
|
||||
public Boolean getValue() {
|
||||
return getType() == TRUE ? Boolean.TRUE : Boolean.FALSE;
|
||||
return getType() == TRUE ;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -133,7 +133,7 @@ public class ASTPrinter {
|
|||
* or just the integer as a string if none exists.
|
||||
*/
|
||||
public String getTokenTypeName(int type) {
|
||||
final Integer typeInteger = new Integer( type );
|
||||
final Integer typeInteger = type;
|
||||
String value = null;
|
||||
if ( tokenTypeNameCache != null ) {
|
||||
value = ( String ) tokenTypeNameCache.get( typeInteger );
|
||||
|
|
|
@ -448,11 +448,11 @@ public final class ASTUtil {
|
|||
rtn = ( Integer ) value;
|
||||
}
|
||||
else if ( value instanceof Short ) {
|
||||
rtn = new Integer( ( ( Short ) value ).intValue() );
|
||||
rtn = ( ( Short ) value ).intValue();
|
||||
}
|
||||
else if ( value instanceof Long ) {
|
||||
if ( ( ( Long ) value ).longValue() <= Integer.MAX_VALUE ) {
|
||||
rtn = new Integer( ( ( Long ) value ).intValue() );
|
||||
rtn = ( ( Long ) value ).intValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,13 +114,13 @@ public final class IdentifierGeneratorHelper {
|
|||
|
||||
Class clazz = type.getReturnedClass();
|
||||
if ( clazz == Long.class ) {
|
||||
return new Long( rs.getLong( 1 ) );
|
||||
return rs.getLong( 1 );
|
||||
}
|
||||
else if ( clazz == Integer.class ) {
|
||||
return new Integer( rs.getInt( 1 ) );
|
||||
return rs.getInt( 1 );
|
||||
}
|
||||
else if ( clazz == Short.class ) {
|
||||
return new Short( rs.getShort( 1 ) );
|
||||
return rs.getShort( 1 );
|
||||
}
|
||||
else if ( clazz == String.class ) {
|
||||
return rs.getString( 1 );
|
||||
|
@ -153,13 +153,13 @@ public final class IdentifierGeneratorHelper {
|
|||
@Deprecated
|
||||
public static Number createNumber(long value, Class clazz) throws IdentifierGenerationException {
|
||||
if ( clazz == Long.class ) {
|
||||
return new Long( value );
|
||||
return value;
|
||||
}
|
||||
else if ( clazz == Integer.class ) {
|
||||
return new Integer( ( int ) value );
|
||||
return ( int ) value;
|
||||
}
|
||||
else if ( clazz == Short.class ) {
|
||||
return new Short( ( short ) value );
|
||||
return ( short ) value;
|
||||
}
|
||||
else {
|
||||
throw new IdentifierGenerationException( "unrecognized id type : " + clazz.getName() );
|
||||
|
@ -345,13 +345,13 @@ public final class IdentifierGeneratorHelper {
|
|||
// TODO : should we check for truncation?
|
||||
checkInitialized();
|
||||
if ( exactType == Long.class ) {
|
||||
return new Long( value );
|
||||
return value;
|
||||
}
|
||||
else if ( exactType == Integer.class ) {
|
||||
return new Integer( ( int ) value );
|
||||
return ( int ) value;
|
||||
}
|
||||
else {
|
||||
return new Short( ( short ) value );
|
||||
return ( short ) value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -511,39 +511,39 @@ public abstract class AbstractQueryImpl implements Query {
|
|||
}
|
||||
|
||||
public Query setBoolean(int position, boolean val) {
|
||||
Boolean valueToUse = val ? Boolean.TRUE : Boolean.FALSE;
|
||||
Boolean valueToUse = val;
|
||||
Type typeToUse = determineType( position, valueToUse, StandardBasicTypes.BOOLEAN );
|
||||
setParameter( position, valueToUse, typeToUse );
|
||||
return this;
|
||||
}
|
||||
|
||||
public Query setByte(int position, byte val) {
|
||||
setParameter(position, new Byte(val), StandardBasicTypes.BYTE);
|
||||
setParameter(position, val, StandardBasicTypes.BYTE);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Query setShort(int position, short val) {
|
||||
setParameter(position, new Short(val), StandardBasicTypes.SHORT);
|
||||
setParameter(position, val, StandardBasicTypes.SHORT);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Query setInteger(int position, int val) {
|
||||
setParameter(position, new Integer(val), StandardBasicTypes.INTEGER);
|
||||
setParameter(position, val, StandardBasicTypes.INTEGER);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Query setLong(int position, long val) {
|
||||
setParameter(position, new Long(val), StandardBasicTypes.LONG);
|
||||
setParameter(position, val, StandardBasicTypes.LONG);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Query setFloat(int position, float val) {
|
||||
setParameter(position, new Float(val), StandardBasicTypes.FLOAT);
|
||||
setParameter(position, val, StandardBasicTypes.FLOAT);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Query setDouble(int position, double val) {
|
||||
setParameter(position, new Double(val), StandardBasicTypes.DOUBLE);
|
||||
setParameter(position, val, StandardBasicTypes.DOUBLE);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -615,19 +615,19 @@ public abstract class AbstractQueryImpl implements Query {
|
|||
}
|
||||
|
||||
public Query setBoolean(String name, boolean val) {
|
||||
Boolean valueToUse = val ? Boolean.TRUE : Boolean.FALSE;
|
||||
Boolean valueToUse = val;
|
||||
Type typeToUse = determineType( name, valueToUse, StandardBasicTypes.BOOLEAN );
|
||||
setParameter( name, valueToUse, typeToUse );
|
||||
return this;
|
||||
}
|
||||
|
||||
public Query setByte(String name, byte val) {
|
||||
setParameter(name, new Byte(val), StandardBasicTypes.BYTE);
|
||||
setParameter(name, val, StandardBasicTypes.BYTE);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Query setCharacter(String name, char val) {
|
||||
setParameter(name, new Character(val), StandardBasicTypes.CHARACTER);
|
||||
setParameter(name, val, StandardBasicTypes.CHARACTER);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -637,7 +637,7 @@ public abstract class AbstractQueryImpl implements Query {
|
|||
}
|
||||
|
||||
public Query setDouble(String name, double val) {
|
||||
setParameter(name, new Double(val), StandardBasicTypes.DOUBLE);
|
||||
setParameter(name, val, StandardBasicTypes.DOUBLE);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -647,12 +647,12 @@ public abstract class AbstractQueryImpl implements Query {
|
|||
}
|
||||
|
||||
public Query setFloat(String name, float val) {
|
||||
setParameter(name, new Float(val), StandardBasicTypes.FLOAT);
|
||||
setParameter(name, val, StandardBasicTypes.FLOAT);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Query setInteger(String name, int val) {
|
||||
setParameter(name, new Integer(val), StandardBasicTypes.INTEGER);
|
||||
setParameter(name, val, StandardBasicTypes.INTEGER);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -672,7 +672,7 @@ public abstract class AbstractQueryImpl implements Query {
|
|||
}
|
||||
|
||||
public Query setLong(String name, long val) {
|
||||
setParameter(name, new Long(val), StandardBasicTypes.LONG);
|
||||
setParameter(name, val, StandardBasicTypes.LONG);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -682,7 +682,7 @@ public abstract class AbstractQueryImpl implements Query {
|
|||
}
|
||||
|
||||
public Query setShort(String name, short val) {
|
||||
setParameter(name, new Short(val), StandardBasicTypes.SHORT);
|
||||
setParameter(name, val, StandardBasicTypes.SHORT);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ public class FetchingScrollableResultsImpl extends AbstractScrollableResults {
|
|||
if ( afterLast ) {
|
||||
if ( maxPosition == null ) {
|
||||
// we just hit the last position
|
||||
maxPosition = new Integer( currentPosition );
|
||||
maxPosition = currentPosition;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -771,7 +771,7 @@ public abstract class AbstractCollectionPersister
|
|||
|
||||
protected Object decrementIndexByBase(Object index) {
|
||||
if ( baseIndex != 0 ) {
|
||||
index = new Integer( ( (Integer) index ).intValue() - baseIndex );
|
||||
index = (Integer)index - baseIndex;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
@ -824,7 +824,7 @@ public abstract class AbstractCollectionPersister
|
|||
|
||||
protected Object incrementIndexByBase(Object index) {
|
||||
if ( baseIndex != 0 ) {
|
||||
index = new Integer( ( (Integer) index ).intValue() + baseIndex );
|
||||
index = (Integer)index + baseIndex;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ public abstract class BasicLazyInitializer extends AbstractLazyInitializer {
|
|||
}
|
||||
else if ( params==1 ) {
|
||||
if ( !overridesEquals && "equals".equals(methodName) ) {
|
||||
return args[0]==proxy ? Boolean.TRUE : Boolean.FALSE;
|
||||
return args[0]==proxy;
|
||||
}
|
||||
else if ( method.equals(setIdentifierMethod) ) {
|
||||
initialize();
|
||||
|
|
|
@ -44,7 +44,7 @@ public class ByteType
|
|||
|
||||
public static final ByteType INSTANCE = new ByteType();
|
||||
|
||||
private static final Byte ZERO = new Byte( (byte) 0 );
|
||||
private static final Byte ZERO = Byte.valueOf( (byte)0 );
|
||||
|
||||
public ByteType() {
|
||||
super( TinyIntTypeDescriptor.INSTANCE, ByteTypeDescriptor.INSTANCE );
|
||||
|
|
|
@ -68,12 +68,12 @@ public class LongType
|
|||
}
|
||||
|
||||
public Long stringToObject(String xml) throws Exception {
|
||||
return new Long(xml);
|
||||
return Long.valueOf( xml );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing", "UnnecessaryUnboxing" })
|
||||
public Long next(Long current, SessionImplementor session) {
|
||||
return Long.valueOf( current.longValue() + 1 );
|
||||
return current + 1l;
|
||||
}
|
||||
|
||||
public Long seed(SessionImplementor session) {
|
||||
|
|
|
@ -72,7 +72,7 @@ public class ShortType
|
|||
}
|
||||
|
||||
public Short stringToObject(String xml) throws Exception {
|
||||
return new Short(xml);
|
||||
return Short.valueOf( xml );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing", "UnnecessaryUnboxing" })
|
||||
|
|
|
@ -206,7 +206,7 @@ public abstract class AbstractQueryImpl<X> implements TypedQuery<X> {
|
|||
else if ( SPEC_HINT_TIMEOUT.equals( hintName ) ) {
|
||||
// convert milliseconds to seconds
|
||||
int timeout = (int)Math.round(ConfigurationHelper.getInteger( value ).doubleValue() / 1000.0 );
|
||||
applyTimeout( new Integer(timeout) );
|
||||
applyTimeout( timeout );
|
||||
}
|
||||
else if ( HINT_COMMENT.equals( hintName ) ) {
|
||||
applyComment( (String) value );
|
||||
|
|
|
@ -660,7 +660,7 @@ public class Ejb3Configuration implements Serializable, Referenceable {
|
|||
}
|
||||
|
||||
if ( ! overridenDatasource && ( info.getJtaDataSource() != null || info.getNonJtaDataSource() != null ) ) {
|
||||
isJTA = info.getJtaDataSource() != null ? Boolean.TRUE : Boolean.FALSE;
|
||||
isJTA = info.getJtaDataSource() != null;
|
||||
this.setDataSource(
|
||||
isJTA ? info.getJtaDataSource() : info.getNonJtaDataSource()
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue