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


Java InvocationTargetException.toString方法代码示例

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


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

示例1: compare

import java.lang.reflect.InvocationTargetException; //导入方法依赖的package包/类
/**
 * Compare two JavaBeans by their shared property.
 * If {@link #getProperty} is null then the actual objects will be compared.
 *
 * @param  o1 Object The first bean to get data from to compare against
 * @param  o2 Object The second bean to get data from to compare
 * @return int negative or positive based on order
 */
public int compare( final T o1, final T o2 ) {

    if ( property == null ) {
        // compare the actual objects
        return internalCompare( o1, o2 );
    }

    try {
        final Object value1 = PropertyUtils.getProperty( o1, property );
        final Object value2 = PropertyUtils.getProperty( o2, property );
        return internalCompare( value1, value2 );
    }
    catch ( final IllegalAccessException iae ) {
        throw new RuntimeException( "IllegalAccessException: " + iae.toString() );
    }
    catch ( final InvocationTargetException ite ) {
        throw new RuntimeException( "InvocationTargetException: " + ite.toString() );
    }
    catch ( final NoSuchMethodException nsme ) {
        throw new RuntimeException( "NoSuchMethodException: " + nsme.toString() );
    }
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:31,代码来源:BeanComparator.java

示例2: getSolver

import java.lang.reflect.InvocationTargetException; //导入方法依赖的package包/类
public Solver getSolver(SolverManager solverManager){
if (solver == null){
    try{
	Class classRef = Class.forName(className);
	Class[] argTypes = {SolverManager.class};
	Method newInstanceMethod = classRef.getMethod("newInstance", argTypes);
	Object[] args = {solverManager};
	solver = (Solver)newInstanceMethod.invoke(null, args);
    } catch (ClassNotFoundException cnfe){
	throw new InternalError(cnfe.toString());
    } catch (IllegalAccessException iae){
	throw new InternalError(iae.toString());
    } catch (NoSuchMethodException nsme){
	throw new InternalError("Method newInstance(SolverManager) is missing in class " + className);
    } catch (InvocationTargetException ite){
    	ite.printStackTrace();
	throw new InternalError(ite.toString());
    }
}
return solver;
   }
 
开发者ID:wwu-pi,项目名称:tap17-muggl-javaee,代码行数:22,代码来源:SolverInfo.java


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