Search in sources :

Example 1 with MethodLifeCycleHandler

use of com.dtflys.forest.reflection.MethodLifeCycleHandler in project forest by dromara.

the class ForestRequest method execute.

/**
 * 执行请求发送过程
 *
 * @param type 结果返回类型, {@link Type} 接口实例
 * @param <R> 泛型参数: 结果返回类型
 * @return 请求执行响应后返回的结果, 其为 {@link Type} 参数所指定的类型
 */
public <R> R execute(Type type) {
    LifeCycleHandler lifeCycleHandler = getLifeCycleHandler();
    MethodLifeCycleHandler<R> methodLifeCycleHandler = new MethodLifeCycleHandler<>(type, lifeCycleHandler.getOnSuccessClassGenericType());
    Object ret = execute(getBackend(), methodLifeCycleHandler);
    return (R) ret;
}
Also used : MethodLifeCycleHandler(com.dtflys.forest.reflection.MethodLifeCycleHandler) LifeCycleHandler(com.dtflys.forest.handler.LifeCycleHandler) MethodLifeCycleHandler(com.dtflys.forest.reflection.MethodLifeCycleHandler)

Example 2 with MethodLifeCycleHandler

use of com.dtflys.forest.reflection.MethodLifeCycleHandler in project forest by dromara.

the class ForestRequest method execute.

/**
 * 执行请求发送过程
 *
 * @param clazz 结果返回类型, {@link Class} 对象
 * @param <R> 泛型参数: 结果返回类型
 * @return 请求执行响应后返回的结果, 其为 {@code Class<R>} 参数所指定的类型
 */
public <R> R execute(Class<R> clazz) {
    LifeCycleHandler lifeCycleHandler = getLifeCycleHandler();
    MethodLifeCycleHandler<R> methodLifeCycleHandler = new MethodLifeCycleHandler<>(clazz, lifeCycleHandler.getOnSuccessClassGenericType());
    Object ret = execute(getBackend(), methodLifeCycleHandler);
    return (R) ret;
}
Also used : MethodLifeCycleHandler(com.dtflys.forest.reflection.MethodLifeCycleHandler) LifeCycleHandler(com.dtflys.forest.handler.LifeCycleHandler) MethodLifeCycleHandler(com.dtflys.forest.reflection.MethodLifeCycleHandler)

Aggregations

LifeCycleHandler (com.dtflys.forest.handler.LifeCycleHandler)2 MethodLifeCycleHandler (com.dtflys.forest.reflection.MethodLifeCycleHandler)2