HHH-6292 avoid Boolean instance creation

This commit is contained in:
Strong Liu 2011-06-04 12:36:11 +08:00
parent 421585526c
commit 252eee4dd2
5 changed files with 25 additions and 25 deletions

View File

@ -144,7 +144,7 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
if ( hasQueuedOperations() ) {
session.flush();
}
return new Boolean( persister.indexExists( entry.getLoadedKey(), index, session ) );
return persister.indexExists( entry.getLoadedKey(), index, session );
}
}
read();
@ -161,7 +161,7 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
if ( hasQueuedOperations() ) {
session.flush();
}
return new Boolean( persister.elementExists( entry.getLoadedKey(), element, session ) );
return persister.elementExists( entry.getLoadedKey(), element, session );
}
}
read();

View File

@ -185,9 +185,9 @@ public class WhereParser implements Parser {
// The following variables are stacks that keep information about each subexpression
// in the list of nested subexpressions we are currently processing.
private LinkedList nots = new LinkedList(); //were an odd or even number of NOTs encountered
private LinkedList<Boolean> nots = new LinkedList<Boolean>(); //were an odd or even number of NOTs encountered
private LinkedList joins = new LinkedList(); //the join string built up by compound paths inside this expression
private LinkedList booleanTests = new LinkedList(); //a flag indicating if the subexpression is known to be boolean
private LinkedList<Boolean> booleanTests = new LinkedList<Boolean>(); //a flag indicating if the subexpression is known to be boolean
private String getElementName(PathExpressionParser.CollectionElement element, QueryTranslatorImpl q) throws QueryException {
String name;
@ -275,7 +275,7 @@ public class WhereParser implements Parser {
}
if ( lcToken.equals( "not" ) ) {
nots.addLast( new Boolean( !( ( Boolean ) nots.removeLast() ).booleanValue() ) );
nots.addLast( !( nots.removeLast() ) );
negated = !negated;
return; //NOTE: early return
}
@ -309,7 +309,7 @@ public class WhereParser implements Parser {
}
private void closeExpression(QueryTranslatorImpl q, String lcToken) {
if ( ( ( Boolean ) booleanTests.removeLast() ).booleanValue() ) { //it was a boolean expression
if ( booleanTests.removeLast() ) { //it was a boolean expression
if ( booleanTests.size() > 0 ) {
// the next one up must also be
@ -326,7 +326,7 @@ public class WhereParser implements Parser {
( ( StringBuffer ) joins.getLast() ).append( join.toString() );
}
if ( ( ( Boolean ) nots.removeLast() ).booleanValue() ) negated = !negated;
if ( nots.removeLast() ) negated = !negated;
if ( !")".equals( lcToken ) ) appendToken( q, ")" );
}

View File

@ -173,7 +173,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
keyColumns.add(keyCols);
keyColumnReaders.add(keyColReaders);
keyColumnReaderTemplates.add(keyColReaderTemplates);
cascadeDeletes.add( new Boolean( key.isCascadeDeleteEnabled() && factory.getDialect().supportsCascadeDelete() ) );
cascadeDeletes.add( key.isCascadeDeleteEnabled() && factory.getDialect().supportsCascadeDelete() );
}
//Span of the tables directly mapped by this entity and super-classes, if any
@ -210,7 +210,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
keyColumns.add(keyCols);
keyColumnReaders.add(keyColReaders);
keyColumnReaderTemplates.add(keyColReaderTemplates);
cascadeDeletes.add( new Boolean( key.isCascadeDeleteEnabled() && factory.getDialect().supportsCascadeDelete() ) );
cascadeDeletes.add( key.isCascadeDeleteEnabled() && factory.getDialect().supportsCascadeDelete() );
}
naturalOrderTableNames = ArrayHelper.toStringArray( tables );
@ -228,7 +228,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
titer = persistentClass.getSubclassTableClosureIterator();
while ( titer.hasNext() ) {
Table tab = (Table) titer.next();
isConcretes.add( new Boolean( persistentClass.isClassOrSuperclassTable(tab) ) );
isConcretes.add( persistentClass.isClassOrSuperclassTable(tab) );
isDeferreds.add(Boolean.FALSE);
isLazies.add(Boolean.FALSE);
String tabname = tab.getQualifiedName(
@ -252,9 +252,9 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
Table tab = join.getTable();
isConcretes.add( new Boolean( persistentClass.isClassOrSuperclassTable(tab) ) );
isDeferreds.add( new Boolean( join.isSequentialSelect() ) );
isLazies.add(new Boolean(join.isLazy()));
isConcretes.add( persistentClass.isClassOrSuperclassTable(tab) );
isDeferreds.add( join.isSequentialSelect() );
isLazies.add(join.isLazy());
String tabname = tab.getQualifiedName(
factory.getDialect(),

View File

@ -235,11 +235,11 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
boolean hasDeferred = false;
ArrayList subclassTables = new ArrayList();
ArrayList joinKeyColumns = new ArrayList();
ArrayList isConcretes = new ArrayList();
ArrayList isDeferreds = new ArrayList();
ArrayList isInverses = new ArrayList();
ArrayList isNullables = new ArrayList();
ArrayList isLazies = new ArrayList();
ArrayList<Boolean> isConcretes = new ArrayList<Boolean>();
ArrayList<Boolean> isDeferreds = new ArrayList<Boolean>();
ArrayList<Boolean> isInverses = new ArrayList<Boolean>();
ArrayList<Boolean> isNullables = new ArrayList<Boolean>();
ArrayList<Boolean> isLazies = new ArrayList<Boolean>();
subclassTables.add( qualifiedTableNames[0] );
joinKeyColumns.add( getIdentifierColumnNames() );
isConcretes.add(Boolean.TRUE);
@ -250,11 +250,11 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
joinIter = persistentClass.getSubclassJoinClosureIterator();
while ( joinIter.hasNext() ) {
Join join = (Join) joinIter.next();
isConcretes.add( new Boolean( persistentClass.isClassOrSuperclassJoin(join) ) );
isDeferreds.add( new Boolean( join.isSequentialSelect() ) );
isInverses.add( new Boolean( join.isInverse() ) );
isNullables.add( new Boolean( join.isOptional() ) );
isLazies.add( new Boolean( lazyAvailable && join.isLazy() ) );
isConcretes.add( persistentClass.isClassOrSuperclassJoin(join) );
isDeferreds.add( join.isSequentialSelect() );
isInverses.add( join.isInverse() );
isNullables.add( join.isOptional() );
isLazies.add( lazyAvailable && join.isLazy() );
if ( join.isSequentialSelect() && !persistentClass.isClassOrSuperclassJoin(join) ) hasDeferred = true;
subclassTables.add( join.getTable().getQualifiedName(
factory.getDialect(),
@ -368,7 +368,7 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
iter = persistentClass.getSubclassPropertyClosureIterator();
while ( iter.hasNext() ) {
Property prop = (Property) iter.next();
Integer join = new Integer( persistentClass.getJoinNumber(prop) );
Integer join = persistentClass.getJoinNumber(prop);
propertyJoinNumbers.add(join);
//propertyTableNumbersByName.put( prop.getName(), join );

View File

@ -111,7 +111,7 @@ public class CustomPersister implements EntityPersister {
}
public Boolean isTransient(Object object, SessionImplementor session) {
return new Boolean( ( (Custom) object ).id==null );
return ( (Custom) object ).id==null;
}
public Object[] getPropertyValuesToInsert(Object object, Map mergeMap, SessionImplementor session)