code format and fixing typo

This commit is contained in:
Strong Liu 2012-12-31 22:00:51 +08:00
parent 1c0b551055
commit 781133164b
6 changed files with 19 additions and 17 deletions

View File

@ -24,7 +24,7 @@ on the Jira HHH-123 : `git checkout -b HHH-123 master`
## Code ## Code
Do yo thang! Do yo thing!
## Commit ## Commit

View File

@ -66,7 +66,7 @@ public class FilterDefinition implements Serializable {
* *
* @return The parameters named by this configuration. * @return The parameters named by this configuration.
*/ */
public Set getParameterNames() { public Set<String> getParameterNames() {
return parameterTypes.keySet(); return parameterTypes.keySet();
} }

View File

@ -55,8 +55,8 @@ public class LoadQueryInfluencers implements Serializable {
private final SessionFactoryImplementor sessionFactory; private final SessionFactoryImplementor sessionFactory;
private String internalFetchProfile; private String internalFetchProfile;
private Map<String,Filter> enabledFilters; private final Map<String,Filter> enabledFilters;
private Set<String> enabledFetchProfileNames; private final Set<String> enabledFetchProfileNames;
public LoadQueryInfluencers() { public LoadQueryInfluencers() {
this( null, Collections.<String, Filter>emptyMap(), Collections.<String>emptySet() ); this( null, Collections.<String, Filter>emptyMap(), Collections.<String>emptySet() );
@ -96,7 +96,7 @@ public class LoadQueryInfluencers implements Serializable {
// filter support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // filter support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
public boolean hasEnabledFilters() { public boolean hasEnabledFilters() {
return enabledFilters != null && !enabledFilters.isEmpty(); return !enabledFilters.isEmpty();
} }
public Map<String,Filter> getEnabledFilters() { public Map<String,Filter> getEnabledFilters() {
@ -167,7 +167,7 @@ public class LoadQueryInfluencers implements Serializable {
// fetch profile support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // fetch profile support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
public boolean hasEnabledFetchProfiles() { public boolean hasEnabledFetchProfiles() {
return enabledFetchProfileNames != null && !enabledFetchProfileNames.isEmpty(); return !enabledFetchProfileNames.isEmpty();
} }
public Set getEnabledFetchProfileNames() { public Set getEnabledFetchProfileNames() {

View File

@ -41,7 +41,7 @@ public class ConnectionObserverStatsBridge implements ConnectionObserver, Serial
@Override @Override
public void physicalConnectionObtained(Connection connection) { public void physicalConnectionObtained(Connection connection) {
if (sessionFactory.getStatistics().isStatisticsEnabled()) { if ( sessionFactory.getStatistics().isStatisticsEnabled() ) {
sessionFactory.getStatisticsImplementor().connect(); sessionFactory.getStatisticsImplementor().connect();
} }
} }
@ -56,7 +56,7 @@ public class ConnectionObserverStatsBridge implements ConnectionObserver, Serial
@Override @Override
public void statementPrepared() { public void statementPrepared() {
if (sessionFactory.getStatistics().isStatisticsEnabled()) { if ( sessionFactory.getStatistics().isStatisticsEnabled() ) {
sessionFactory.getStatisticsImplementor().prepareStatement(); sessionFactory.getStatisticsImplementor().prepareStatement();
} }
} }

View File

@ -120,7 +120,7 @@ public class FilterImpl implements Filter, Serializable {
if ( type == null ) { if ( type == null ) {
throw new HibernateException( "Undefined filter parameter [" + name + "]" ); throw new HibernateException( "Undefined filter parameter [" + name + "]" );
} }
if ( values.size() > 0 ) { if ( !values.isEmpty() ) {
Class elementClass = values.iterator().next().getClass(); Class elementClass = values.iterator().next().getClass();
if ( !type.getReturnedClass().isAssignableFrom( elementClass ) ) { if ( !type.getReturnedClass().isAssignableFrom( elementClass ) ) {
throw new HibernateException( "Incorrect type for parameter [" + name + "]" ); throw new HibernateException( "Incorrect type for parameter [" + name + "]" );
@ -161,9 +161,8 @@ public class FilterImpl implements Filter, Serializable {
public void validate() throws HibernateException { public void validate() throws HibernateException {
// for each of the defined parameters, make sure its value // for each of the defined parameters, make sure its value
// has been set // has been set
Iterator itr = definition.getParameterNames().iterator();
while ( itr.hasNext() ) { for ( final String parameterName : definition.getParameterNames() ) {
final String parameterName = (String) itr.next();
if ( parameters.get( parameterName ) == null ) { if ( parameters.get( parameterName ) == null ) {
throw new HibernateException( throw new HibernateException(
"Filter [" + getName() + "] parameter [" + parameterName + "] value not set" "Filter [" + getName() + "] parameter [" + parameterName + "] value not set"

View File

@ -109,6 +109,7 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SessionOwner; import org.hibernate.engine.spi.SessionOwner;
import org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl; import org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl;
import org.hibernate.engine.transaction.spi.TransactionEnvironment; import org.hibernate.engine.transaction.spi.TransactionEnvironment;
import org.hibernate.engine.transaction.spi.TransactionFactory;
import org.hibernate.exception.spi.SQLExceptionConverter; import org.hibernate.exception.spi.SQLExceptionConverter;
import org.hibernate.id.IdentifierGenerator; import org.hibernate.id.IdentifierGenerator;
import org.hibernate.id.UUIDGenerator; import org.hibernate.id.UUIDGenerator;
@ -1326,14 +1327,16 @@ public final class SessionFactoryImpl
return results.toArray( new String[results.size()] ); return results.toArray( new String[results.size()] );
} }
@Override
public String getImportedClassName(String className) { public String getImportedClassName(String className) {
String result = imports.get(className); String result = imports.get( className );
if (result==null) { if ( result == null ) {
try { try {
serviceRegistry.getService( ClassLoaderService.class ).classForName( className ); serviceRegistry.getService( ClassLoaderService.class ).classForName( className );
imports.put( className, className );
return className; return className;
} }
catch (ClassLoadingException cnfe) { catch ( ClassLoadingException cnfe ) {
return null; return null;
} }
} }
@ -1515,8 +1518,8 @@ public final class SessionFactoryImpl
return identifierGenerators.get(rootEntityName); return identifierGenerators.get(rootEntityName);
} }
private org.hibernate.engine.transaction.spi.TransactionFactory transactionFactory() { private TransactionFactory transactionFactory() {
return serviceRegistry.getService( org.hibernate.engine.transaction.spi.TransactionFactory.class ); return serviceRegistry.getService( TransactionFactory.class );
} }
private boolean canAccessTransactionManager() { private boolean canAccessTransactionManager() {