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


Java BeanUtil.invoke方法代码示例

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


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

示例1: invoke

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
@Override
public Object invoke(Object proxy, Method method, Object[] args)
		throws Throwable {
	try {
		String methodName = method.getName();
		if ("close".equals(methodName)) {
			openResultSetCount.decrementAndGet();
			if (openResultSetMonitor != null)
				openResultSetMonitor.unregister(this);
			JDBC_LOGGER.debug("closing result set {}", this);
		} else if ("toString".equals(methodName)) {
			return "ResultSet (" + statement + ")";
		} else if ("getStatement".equals(methodName)) {
			return statement;
		}
		return BeanUtil.invoke(realResultSet, method, args);
	} catch (ConfigurationError e) {
		if (e.getCause() instanceof InvocationTargetException && e.getCause().getCause() instanceof SQLException)
			throw e.getCause().getCause();
		else
			throw e;
	}
}
 
开发者ID:aravindc,项目名称:jdbacl,代码行数:24,代码来源:LoggingResultSetHandler.java

示例2: invoke

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
@Override
public Object invoke(Object proxy, Method method, Object[] args)
		throws Throwable {
	try {
		String methodName = method.getName();
		Method localMethod = BeanUtil.findMethod(this.getClass(), methodName, method.getParameterTypes());
		if (localMethod != null)
			return BeanUtil.invoke(this, localMethod, args);
		else {
			if ("setNull".equals(methodName) && args != null && args.length >= 2)
				params[(Integer) args[0] - 1] = null;
			else if (methodName.startsWith("set") && args != null && args.length >= 2 && args[0] instanceof Integer)
				params[(Integer) args[0] - 1] = args[1];
			Object result = BeanUtil.invoke(realStatement, method, args);
			if (result instanceof ResultSet)
				result = DBUtil.createLoggingResultSet((ResultSet) result, (PreparedStatement) proxy);
			return result;
		}
	} catch (ConfigurationError e) {
		if (e.getCause() instanceof InvocationTargetException && e.getCause().getCause() instanceof SQLException)
			throw e.getCause().getCause();
		else
			throw e;
	}
}
 
开发者ID:aravindc,项目名称:jdbacl,代码行数:26,代码来源:LoggingPreparedStatementHandler.java

示例3: invoke

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
@Override
public Object invoke(Object proxy, Method method, Object[] args)
		throws Throwable {
	String methodName = method.getName();
	if ("close".equals(methodName))
		this.close();
	else if ("getConnection".equals(methodName) && (args == null || args.length == 0))
		return this.getConnection();
	else if ("addConnectionEventListener".equals(methodName)) {
		this.addConnectionEventListener((ConnectionEventListener) args[0]);
		return null;
	} else if ("removeConnectionEventListener".equals(methodName)) {
		this.removeConnectionEventListener((ConnectionEventListener) args[0]);
		return null;
	} else if ("prepareStatement".equals(methodName)) {
		switch (args.length) {
			case 1: return DBUtil.prepareStatement(realConnection, (String) args[0], readOnly);
			case 2: 
				if (method.getParameterTypes()[1] == int.class)
					return DBUtil.prepareStatement(realConnection, (String) args[0], readOnly,
							(Integer) args[1], ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT);
				else
					break;
			case 3: return DBUtil.prepareStatement(realConnection, (String) args[0], readOnly,
					(Integer) args[1], (Integer) args[2], ResultSet.HOLD_CURSORS_OVER_COMMIT);
			case 4: return DBUtil.prepareStatement(realConnection, (String) args[0], readOnly, 
					(Integer) args[1], (Integer) args[2], (Integer) args[3]);
		}
	} else if ("createStatement".equals(methodName))
		return createStatement(method, args);
	return BeanUtil.invoke(realConnection, method, args);
}
 
开发者ID:aravindc,项目名称:jdbacl,代码行数:33,代码来源:PooledConnectionHandler.java

示例4: invoke

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
@Override
public Object invoke(Object proxy, Method method, Object[] args)
		throws Throwable {
	try {
		String methodName = method.getName();
		Method localMethod = BeanUtil.findMethod(this.getClass(), methodName, method.getParameterTypes());
		Object result;
		boolean profile = methodName.startsWith("execute") && "true".equals(System.getProperty("profile"));
		long startTime = 0;
		if (profile)
			startTime = System.nanoTime();
		if (localMethod != null)
			result = BeanUtil.invoke(this, localMethod, args);
		else
			result = BeanUtil.invoke(realStatement, method, args);
		if (result instanceof ResultSet)
			result = DBUtil.createLoggingResultSet((ResultSet) result, (Statement) proxy);
		if (profile) {
			long duration = (System.nanoTime() - startTime) / 1000000;
			Profiler.defaultInstance().addSample(CollectionUtil.toList("SQL", sql), duration);
		}
		return result;
	} catch (ConfigurationError e) {
		if (e.getCause() instanceof InvocationTargetException && e.getCause().getCause() instanceof SQLException)
			throw e.getCause().getCause();
		else
			throw e;
	}
}
 
开发者ID:aravindc,项目名称:jdbacl,代码行数:30,代码来源:LoggingStatementHandler.java

示例5: invokeByEntity

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
private void invokeByEntity(Entity object) {
Object[] args = object.getComponents().values().toArray();
if (target instanceof Class)
	BeanUtil.invokeStatic((Class<?>) target, methodName, args);
else
	BeanUtil.invoke(false, target, methodName, args);
  }
 
开发者ID:raphaelfeng,项目名称:benerator,代码行数:8,代码来源:JavaInvoker.java

示例6: createStatement

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
private Statement createStatement(Method method, Object[] args) {
	Statement statement = (Statement) BeanUtil.invoke(realConnection, method, args);
       return DBUtil.createLoggingStatementHandler(statement, readOnly);
}
 
开发者ID:aravindc,项目名称:jdbacl,代码行数:5,代码来源:PooledConnectionHandler.java

示例7: invokeByArray

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
private void invokeByArray(Object[] args) {
if (target instanceof Class)
	BeanUtil.invokeStatic((Class<?>) target, methodName, args);
else
	BeanUtil.invoke(target, methodName, args);
  }
 
开发者ID:raphaelfeng,项目名称:benerator,代码行数:7,代码来源:JavaInvoker.java

示例8: invokeByObject

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
private void invokeByObject(Object object) {
if (target instanceof Class)
	BeanUtil.invokeStatic((Class<?>) target, methodName, object);
else
	BeanUtil.invoke(target, methodName, object);
  }
 
开发者ID:raphaelfeng,项目名称:benerator,代码行数:7,代码来源:JavaInvoker.java


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