当前位置: 首页>>代码示例>>Java>>正文


Java PropertiesHelper.getBoolean方法代码示例

本文整理汇总了Java中org.hibernate.util.PropertiesHelper.getBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java PropertiesHelper.getBoolean方法的具体用法?Java PropertiesHelper.getBoolean怎么用?Java PropertiesHelper.getBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.hibernate.util.PropertiesHelper的用法示例。


在下文中一共展示了PropertiesHelper.getBoolean方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SchemaExport

import org.hibernate.util.PropertiesHelper; //导入方法依赖的package包/类
/**
 * Create a schema exporter for the given Configuration, with the given
 * database connection properties.
 *
 * @deprecated properties may be specified via the Configuration object
 */
public SchemaExport(Configuration cfg, Properties properties)
		throws HibernateException {
	dialect = Dialect.getDialect( properties );

	Properties props = new Properties();
	props.putAll( dialect.getDefaultProperties() );
	props.putAll( properties );

	connectionHelper = new ManagedProviderConnectionHelper( props );
	dropSQL = cfg.generateDropSchemaScript( dialect );
	createSQL = cfg.generateSchemaCreationScript( dialect );
	format = PropertiesHelper.getBoolean( Environment.FORMAT_SQL, props );
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:20,代码来源:SchemaExport.java

示例2: configure

import org.hibernate.util.PropertiesHelper; //导入方法依赖的package包/类
public void configure(Type type, Properties params, Dialect dialect) throws MappingException {
	identifierType = type;
	boolean forceTableUse = PropertiesHelper.getBoolean( FORCE_TBL_PARAM, params, false );

	String sequenceName = PropertiesHelper.getString( SEQUENCE_PARAM, params, DEF_SEQUENCE_NAME );
	if ( sequenceName.indexOf( '.' ) < 0 ) {
		String schemaName = params.getProperty( SCHEMA );
		String catalogName = params.getProperty( CATALOG );
		sequenceName = Table.qualify( catalogName, schemaName, sequenceName );
	}
	int initialValue = PropertiesHelper.getInt( INITIAL_PARAM, params, DEFAULT_INITIAL_VALUE );
	int incrementSize = PropertiesHelper.getInt( INCREMENT_PARAM, params, DEFAULT_INCREMENT_SIZE );

	String valueColumnName = PropertiesHelper.getString( VALUE_COLUMN_PARAM, params, DEF_VALUE_COLUMN );

	String defOptStrategy = incrementSize <= 1 ? OptimizerFactory.NONE : OptimizerFactory.POOL;
	String optimizationStrategy = PropertiesHelper.getString( OPT_PARAM, params, defOptStrategy );
	if ( OptimizerFactory.NONE.equals( optimizationStrategy ) && incrementSize > 1 ) {
		log.warn( "config specified explicit optimizer of [" + OptimizerFactory.NONE + "], but [" + INCREMENT_PARAM + "=" + incrementSize + "; honoring optimizer setting" );
		incrementSize = 1;
	}
	if ( dialect.supportsSequences() && !forceTableUse ) {
		if ( OptimizerFactory.POOL.equals( optimizationStrategy ) && !dialect.supportsPooledSequences() ) {
			// TODO : may even be better to fall back to a pooled table strategy here so that the db stored values remain consistent...
			optimizationStrategy = OptimizerFactory.HILO;
		}
		databaseStructure = new SequenceStructure( dialect, sequenceName, initialValue, incrementSize );
	}
	else {
		databaseStructure = new TableStructure( dialect, sequenceName, valueColumnName, initialValue, incrementSize );
	}

	optimizer = OptimizerFactory.buildOptimizer( optimizationStrategy, identifierType.getReturnedClass(), incrementSize );
	databaseStructure.prepare( optimizer );
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:36,代码来源:SequenceStyleGenerator.java

示例3: testPlaceholderReplacement

import org.hibernate.util.PropertiesHelper; //导入方法依赖的package包/类
public void testPlaceholderReplacement() {
	PropertiesHelper.resolvePlaceHolders( props );

	String str = PropertiesHelper.getString( "my.nonexistent.prop", props, "did.not.exist" );
	assertEquals( "did.not.exist", str );
	str = PropertiesHelper.getString( "my.nonexistent.prop", props, null );
	assertNull( str );
	str = PropertiesHelper.getString( "my.string.prop", props, "na" );
	assertEquals( "replacement did not occur", "string", str );
	str = PropertiesHelper.getString( "my.string.prop", props, "did.not.exist" );
	assertEquals( "replacement did not occur", "string", str );

	boolean bool = PropertiesHelper.getBoolean( "my.nonexistent.prop", props );
	assertFalse( "non-exists as boolean", bool );
	bool = PropertiesHelper.getBoolean( "my.nonexistent.prop", props, false );
	assertFalse( "non-exists as boolean", bool );
	bool = PropertiesHelper.getBoolean( "my.nonexistent.prop", props, true );
	assertTrue( "non-exists as boolean", bool );
	bool = PropertiesHelper.getBoolean( "my.boolean.prop", props );
	assertTrue( "boolean replacement did not occur", bool );
	bool = PropertiesHelper.getBoolean( "my.boolean.prop", props, false );
	assertTrue( "boolean replacement did not occur", bool );

	int i = PropertiesHelper.getInt( "my.nonexistent.prop", props, -1 );
	assertEquals( -1, i );
	i = PropertiesHelper.getInt( "my.int.prop", props, 100 );
	assertEquals( 1, i );

	Integer I = PropertiesHelper.getInteger( "my.nonexistent.prop", props );
	assertNull( I );
	I = PropertiesHelper.getInteger( "my.integer.prop", props );
	assertEquals( I, new Integer( 1 ) );

	str = props.getProperty( "partial.prop1" );
	assertEquals( "partial replacement (ends)", "tmp/middle/dir/tmp.txt", str );

	str = props.getProperty( "partial.prop2" );
	assertEquals( "partial replacement (midst)", "basedir/tmp/myfile.txt", str );
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:40,代码来源:PropertiesHelperTest.java

示例4: configure

import org.hibernate.util.PropertiesHelper; //导入方法依赖的package包/类
@Override
public void configure(Properties props) throws HibernateException {

    String driverClass = props.getProperty(Environment.DRIVER);

    poolSize = PropertiesHelper.getInt(Environment.POOL_SIZE, props, 20); //default pool size 20
    log.info("Using Hibernate built-in connection pool (not for production use!)");
    log.info("Hibernate connection pool size: " + poolSize);

    autocommit = PropertiesHelper.getBoolean(Environment.AUTOCOMMIT, props);
    log.info("autocommit mode: " + autocommit);

    isolation = PropertiesHelper.getInteger(Environment.ISOLATION, props);
    if (isolation!=null)
    log.info( "JDBC isolation level: " + Environment.isolationLevelToString( isolation.intValue() ) );

    if (driverClass==null) {
        log.warn("no JDBC Driver class was specified by property " + Environment.DRIVER);
    }
    else {
        try {
            // trying via forName() first to be as close to DriverManager's semantics
        	// NOTE for JSS: we use the context class loader because it will be able to locate the database drivers
        	// already loaded in our plug-ins or projects
            driver = (Driver) Class.forName(driverClass, true, Thread.currentThread().getContextClassLoader()).newInstance();
        }
        catch (Exception e) {
            try {
                driver = (Driver) ReflectHelper.classForName(driverClass).newInstance();
            }
            catch (Exception e1) {
                log.error(e1.getMessage());
                throw new HibernateException(e1);
            }
        }
    }

    url = props.getProperty( Environment.URL );
    if ( url == null ) {
        String msg = "JDBC URL was not specified by property " + Environment.URL;
        log.error( msg );
        throw new HibernateException( msg );
    }

    connectionProps = ConnectionProviderFactory.getConnectionProperties( props );

    log.info( "using driver: " + driverClass + " at URL: " + url );
    // if debug level is enabled, then log the password, otherwise mask it
    if ( log.isDebugEnabled() ) {
        log.info( "connection properties: " + connectionProps );
    }
    else if ( log.isInfoEnabled() ) {
        log.info( "connection properties: " + PropertiesHelper.maskOut(connectionProps, "password") );
    }

}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:57,代码来源:HibernateConnectionProvider.java

示例5: isNativeClient

import org.hibernate.util.PropertiesHelper; //导入方法依赖的package包/类
public static boolean isNativeClient(Properties props) {
    return PropertiesHelper.getBoolean(CacheEnvironment.USE_NATIVE_CLIENT, props, false);
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate,代码行数:4,代码来源:CacheEnvironment.java

示例6: shutdownOnStop

import org.hibernate.util.PropertiesHelper; //导入方法依赖的package包/类
public static boolean shutdownOnStop(Properties props, boolean defaultValue) {
    return PropertiesHelper.getBoolean(CacheEnvironment.SHUTDOWN_ON_STOP, props, defaultValue);
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate,代码行数:4,代码来源:CacheEnvironment.java

示例7: isExplicitVersionCheckEnabled

import org.hibernate.util.PropertiesHelper; //导入方法依赖的package包/类
public static boolean isExplicitVersionCheckEnabled(Properties props) {
    return PropertiesHelper.getBoolean(CacheEnvironment.EXPLICIT_VERSION_CHECK, props, false);
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate,代码行数:4,代码来源:CacheEnvironment.java

示例8: isLiteMember

import org.hibernate.util.PropertiesHelper; //导入方法依赖的package包/类
public static boolean isLiteMember(Properties props) {
    return PropertiesHelper.getBoolean(CacheEnvironment.USE_LITE_MEMBER, props, false);
}
 
开发者ID:mdogan,项目名称:hazelcast-archive,代码行数:4,代码来源:CacheEnvironment.java

示例9: isSuperClient

import org.hibernate.util.PropertiesHelper; //导入方法依赖的package包/类
@Deprecated
public static boolean isSuperClient(Properties props) {
    return PropertiesHelper.getBoolean(CacheEnvironment.USE_SUPER_CLIENT, props, false);
}
 
开发者ID:mdogan,项目名称:hazelcast-archive,代码行数:5,代码来源:CacheEnvironment.java


注:本文中的org.hibernate.util.PropertiesHelper.getBoolean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。