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


Java BeanUtil.forName方法代码示例

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


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

示例1: configure

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
@Override
public void configure(Preferences preferences) {
    entries = new ArrayList<AutoRetryEntry>();

    for (String nodeName : preferences.getChildNodeNames()) {
        if (nodeName.matches("retry[0-9]+")) {
            AutoRetryEntry entry = new AutoRetryEntry();
            ValidatingPreferencesWrapper values = new ValidatingPreferencesWrapper(preferences.getChildNode(nodeName));
            entry.maxCount = values.getRequiredIntValue("maxCount");
            entry.methodName = values.getRequiredStringValue("method");
            entry.exceptionClass = BeanUtil.forName(values.getRequiredStringValue("exception"));
            entry.interfaceClass = BeanUtil.forName(values.getRequiredStringValue("interface"));
            entries.add(entry);
        }
    }
}
 
开发者ID:AludraTest,项目名称:aludratest,代码行数:17,代码来源:AutoRetryImpl.java

示例2: connect

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
public static Connection connect(String url, String driverClassName, String user, String password, boolean readOnly) throws ConnectFailedException {
	try {
		if (driverClassName == null)
			throw new ConfigurationError("No JDBC driver class name provided");
		
		// Instantiate driver
           Class<Driver> driverClass = BeanUtil.forName(driverClassName);
           Driver driver = driverClass.newInstance();
           
           // Wrap connection properties
        java.util.Properties info = new java.util.Properties();
		if (user != null)
		    info.put("user", user);
		if (password != null)
		    info.put("password", password);
		
		// connect
           JDBC_LOGGER.debug("opening connection to " + url);
           Connection connection = driver.connect(url, info);
           if (connection == null)
           	throw new ConnectFailedException("Connecting the database failed silently - " +
           			"probably due to wrong driver (" + driverClassName + ") or wrong URL format (" + url + ")");
           connection = wrapWithPooledConnection(connection, readOnly);
		return connection;
       } catch (Exception e) {
		throw new ConnectFailedException("Connecting " + url + " failed: ", e);
	}
}
 
开发者ID:aravindc,项目名称:jdbacl,代码行数:29,代码来源:DBUtil.java

示例3: classForPotentialResourceName

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
public static Class<?> classForPotentialResourceName(String classOrResourceName) {
    String resourceName = classOrResourceName.trim();

    String className;
    if (resourceName.endsWith(".java")) {
        className = deriveClassName(resourceName, "java");
        className = className.substring(0, className.length() - ".java".length());
    }
    else {
        className = resourceName;
    }
    return BeanUtil.forName(className);
}
 
开发者ID:AludraTest,项目名称:aludratest,代码行数:14,代码来源:AppUtil.java

示例4: getTestClass

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
private static Class<?> getTestClass(String[] args) {
    String className = args[0].trim();
    if (className.endsWith(".java")) {
        className = className.substring(0, className.length() - ".java".length());
    }
    return BeanUtil.forName(className);
}
 
开发者ID:AludraTest,项目名称:aludratest,代码行数:8,代码来源:CLIExcelCreator.java


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