@SuppressWarnings("unchecked") @Override public R call(Object... args) { if (args.length != 2) { throw new RuntimeException("Func2 expecting 2 arguments."); } return f.call((T0) args[0], (T1) args[1]); }
@SuppressWarnings("unchecked") @Override public R call(Object... args) { if (args.length != 2) { throw new RuntimeException("Func2 expecting 2 arguments."); } return f.call((T0) args[0], (T1) args[1]); }
@SuppressWarnings("unchecked") @Override public R call(Object... args) { if (args.length != 2) { throw new RuntimeException("Func2 expecting 2 arguments."); } return f.call((T0) args[0], (T1) args[1]); }
private static Parser createParser(Class<?> clazz, Type type) { Func2<Class<?>, Type, Parser> func2 = CLASS_TYPE_PARSER_MAP.get(ClassType.getClassType(clazz)); if (func2 != null) { return func2.call(clazz, type); } else { return null; } }
private static Parser createParser(Class<?> clazz, Type type) { Func2<Class<?>, Type, Parser> func2 = CLASS_TYPE_PARSER_MAP.get(ClassType.getClassType(clazz)); if (func2 != null) { return func2.call(clazz, type); } else { return null; } }
public <T> Promise.Completable<T> async(Connection connection, Func2<Connection, JDBCHelper, T> func) { Promise.Completable<T> c = new Promise.Completable<>(); executorService.submit(() -> { try { c.succeeded(func.call(connection, this)); } catch (Throwable t) { c.failed(t); } }); return c; }
public <T> Promise.Completable<T> async(Connection connection, Func2<Connection, JDBCHelper, T> func) { Promise.Completable<T> c = new Promise.Completable<>(); executorService.submit(() -> { try { c.succeeded(func.call(connection, this)); } catch (Throwable t) { c.failed(t); } }); return c; }
private static Map<String, MethodGenericTypeBind> getGenericBeanMethods(Type type, ReflectUtils.BeanMethodFilter filter, Func2<Class<?>, ReflectUtils.BeanMethodFilter, Map<String, Method>> getMethodMap, Func1<Method, Type> getType) { Class<?> rawClass = extractClass(type); Map<String, Method> methodMap = getMethodMap.call(rawClass, filter); if (methodMap == null || methodMap.isEmpty()) { return Collections.emptyMap(); } else { Map<String, MethodGenericTypeBind> genericTypeBindMap = new HashMap<>(); if (type instanceof ParameterizedType) { Map<String, Type> genericNameTypeMap = createGenericNameTypeMap((ParameterizedType) type); methodMap.forEach((name, method) -> bindMethodType(name, method, getBindType(getType.call(method), genericNameTypeMap), genericTypeBindMap)); return genericTypeBindMap; } else { methodMap.forEach((name, method) -> bindMethodType(name, method, getType.call(method), genericTypeBindMap)); return genericTypeBindMap; } } }
private static Map<String, MethodGenericTypeBind> getGenericBeanMethods(Type type, ReflectUtils.BeanMethodFilter filter, Func2<Class<?>, ReflectUtils.BeanMethodFilter, Map<String, Method>> getMethodMap, Func1<Method, Type> getType) { Class<?> rawClass = extractClass(type); Map<String, Method> methodMap = getMethodMap.call(rawClass, filter); if (methodMap == null || methodMap.isEmpty()) { return Collections.emptyMap(); } else { Map<String, MethodGenericTypeBind> genericTypeBindMap = new HashMap<>(); if (type instanceof ParameterizedType) { Map<String, Type> genericNameTypeMap = createGenericNameTypeMap((ParameterizedType) type); methodMap.forEach((name, method) -> bindMethodType(name, method, getBindType(getType.call(method), genericNameTypeMap), genericTypeBindMap)); return genericTypeBindMap; } else { methodMap.forEach((name, method) -> bindMethodType(name, method, getType.call(method), genericTypeBindMap)); return genericTypeBindMap; } } }
public <T> T executeTransaction(Func2<Connection, JDBCHelper, T> func) { Connection connection = getConnection(); setAutoCommit(connection, false); try { T ret = func.call(connection, this); commit(connection); return ret; } catch (Throwable t) { rollback(connection); log.error("the transaction exception", t); } finally { setAutoCommit(connection, true); close(connection); } return null; }
public <T> T executeTransaction(Func2<Connection, JDBCHelper, T> func) { Connection connection = getConnection(); setAutoCommit(connection, false); try { T ret = func.call(connection, this); commit(connection); return ret; } catch (Throwable t) { rollback(connection); log.error("the transaction exception", t); } finally { setAutoCommit(connection, true); close(connection); } return null; }