HHH-8159 - Apply fixups indicated by analysis tools
This commit is contained in:
parent
e09d6855a2
commit
42fd32a81a
|
@ -24,6 +24,8 @@
|
|||
package org.hibernate.engine;
|
||||
|
||||
/**
|
||||
* Describes how an entity should be optimistically locked.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public enum OptimisticLockStyle {
|
||||
|
|
|
@ -35,10 +35,14 @@ import org.hibernate.engine.query.spi.sql.NativeSQLQueryReturn;
|
|||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public class ResultSetMappingDefinition implements Serializable {
|
||||
|
||||
private final String name;
|
||||
private final List<NativeSQLQueryReturn> queryReturns = new ArrayList<NativeSQLQueryReturn>();
|
||||
|
||||
/**
|
||||
* Constructs a ResultSetMappingDefinition
|
||||
*
|
||||
* @param name The mapping name
|
||||
*/
|
||||
public ResultSetMappingDefinition(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
@ -47,6 +51,11 @@ public class ResultSetMappingDefinition implements Serializable {
|
|||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a return.
|
||||
*
|
||||
* @param queryReturn The return
|
||||
*/
|
||||
public void addQueryReturn(NativeSQLQueryReturn queryReturn) {
|
||||
queryReturns.add( queryReturn );
|
||||
}
|
||||
|
|
|
@ -36,6 +36,8 @@ import org.hibernate.service.spi.ServiceRegistryAwareService;
|
|||
import org.hibernate.service.spi.ServiceRegistryImplementor;
|
||||
|
||||
/**
|
||||
* The standard ConfigurationService implementation
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class ConfigurationServiceImpl implements ConfigurationService, ServiceRegistryAwareService {
|
||||
|
@ -43,9 +45,15 @@ public class ConfigurationServiceImpl implements ConfigurationService, ServiceRe
|
|||
CoreMessageLogger.class,
|
||||
ConfigurationServiceImpl.class.getName()
|
||||
);
|
||||
|
||||
private final Map settings;
|
||||
private ServiceRegistryImplementor serviceRegistry;
|
||||
|
||||
/**
|
||||
* Constructs a ConfigurationServiceImpl
|
||||
*
|
||||
* @param settings The map of settings
|
||||
*/
|
||||
@SuppressWarnings( "unchecked" )
|
||||
public ConfigurationServiceImpl(Map settings) {
|
||||
this.settings = Collections.unmodifiableMap( settings );
|
||||
|
@ -75,18 +83,25 @@ public class ConfigurationServiceImpl implements ConfigurationService, ServiceRe
|
|||
|
||||
return converter.convert( value );
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getSetting(String name, Class<T> expected, T defaultValue) {
|
||||
Object value = settings.get( name );
|
||||
T target = cast( expected, value );
|
||||
final Object value = settings.get( name );
|
||||
final T target = cast( expected, value );
|
||||
return target !=null ? target : defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T cast(Class<T> expected, Object candidate){
|
||||
if(candidate == null) return null;
|
||||
if (candidate == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ( expected.isInstance( candidate ) ) {
|
||||
return (T) candidate;
|
||||
}
|
||||
|
||||
Class<T> target;
|
||||
if ( Class.class.isInstance( candidate ) ) {
|
||||
target = Class.class.cast( candidate );
|
||||
|
|
|
@ -30,11 +30,17 @@ import org.hibernate.engine.config.spi.ConfigurationService;
|
|||
import org.hibernate.service.spi.ServiceRegistryImplementor;
|
||||
|
||||
/**
|
||||
* The ServiceInitiator for the ConfigurationService
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class ConfigurationServiceInitiator implements StandardServiceInitiator<ConfigurationService> {
|
||||
/**
|
||||
* Singleton access
|
||||
*/
|
||||
public static final ConfigurationServiceInitiator INSTANCE = new ConfigurationServiceInitiator();
|
||||
|
||||
@Override
|
||||
public ConfigurationService initiateService(Map configurationValues, ServiceRegistryImplementor registry) {
|
||||
return new ConfigurationServiceImpl( configurationValues );
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2013, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* Internal support for the configuration service implementation
|
||||
*/
|
||||
package org.hibernate.engine.config.internal;
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2013, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* Package for the configuration service, which provides access to configuration settings as part of a
|
||||
* ServiceRegistry
|
||||
*/
|
||||
package org.hibernate.engine.config;
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2013, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* SPI Package for the configuration service.
|
||||
*/
|
||||
package org.hibernate.engine.config.spi;
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2013, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* Support for many of the internal workings of Hibernate.
|
||||
*
|
||||
* See also the {@link org.hibernate.internal} package.
|
||||
*/
|
||||
package org.hibernate.engine.internal;
|
Loading…
Reference in New Issue