@SuppressWarnings("unchecked") public <T> T process(DaoProcessorParam param, Neo4jDaoInfo neo4jDaoInfo) { MethodKey methodKey = new MethodKey(); methodKey.setMethodName(param.getMethodName()); methodKey.setParameTypes(param.getArgTypes()); SqlMethod sqlMethod = neo4jDaoInfo.getSqlMethods().get(methodKey); Optional<Sql> query = sqlCompute.compute(sqlMethod.getDefinition() , neo4jDaoInfo , param.getArgs()); if(!query.isPresent()) throw new Neo4jException("No Query find out"); Sql sql = query.get(); Transaction tx = null; for(Object arg : param.getArgs()) { if(arg instanceof Transaction) tx = (Transaction) arg; } Object obj = tx.runAsync(sql.getSql(), Values.value(sql.getParameters())) .thenComposeAsync(src -> deSerializer.deSerialize(src , sqlMethod)); return (T) obj; } }
SqlMethod sqlMethod = neo4jDaoInfo.getSqlMethods().get(methodKey); Optional<Sql> query = sqlCompute.compute(sqlMethod.getDefinition() , neo4jDaoInfo , param.getArgs()); if(!query.isPresent()) throw new Neo4jException("No Query find out"); Sql sql = query.get(); Transaction tx = null;