简化Parser,getObject和getArray(getArrayConfig)都能用 @author Lemon
| 14 | * @author Lemon |
| 15 | */ |
| 16 | public interface ObjectParser<T, M extends Map<String, Object>, L extends List<Object>> { |
| 17 | |
| 18 | Parser<T, M, L> getParser(); |
| 19 | ObjectParser<T, M, L> setParser(Parser<T, M, L> parser); |
| 20 | |
| 21 | String getParentPath(); |
| 22 | ObjectParser<T, M, L> setParentPath(String parentPath); |
| 23 | |
| 24 | ObjectParser<T, M, L> setCache(M cache); |
| 25 | M getCache(); |
| 26 | |
| 27 | |
| 28 | /**解析成员 |
| 29 | * response重新赋值 |
| 30 | * @param name |
| 31 | * @param isReuse |
| 32 | * @return null or this |
| 33 | * @throws Exception |
| 34 | */ |
| 35 | ObjectParser<T, M, L> parse(String name, boolean isReuse) throws Exception; |
| 36 | |
| 37 | /**调用 parser 的 sqlExecutor 来解析结果 |
| 38 | * @param method |
| 39 | * @param table |
| 40 | * @param alias |
| 41 | * @param request |
| 42 | * @param joinList |
| 43 | * @param isProcedure |
| 44 | * @return |
| 45 | * @throws Exception |
| 46 | */ |
| 47 | M parseResponse(RequestMethod method, String table, String alias, M request, List<Join<T, M, L>> joinList, boolean isProcedure) throws Exception; |
| 48 | /**调用 parser 的 sqlExecutor 来解析结果 |
| 49 | * @param config |
| 50 | * @param isProcedure |
| 51 | * @return |
| 52 | * @throws Exception |
| 53 | */ |
| 54 | M parseResponse(SQLConfig<T, M, L> config, boolean isProcedure) throws Exception; |
| 55 | |
| 56 | |
| 57 | |
| 58 | /**解析普通成员 |
| 59 | * @param key |
| 60 | * @param value |
| 61 | * @return whether parse succeed |
| 62 | */ |
| 63 | boolean onParse(@NotNull String key, @NotNull Object value) throws Exception; |
| 64 | |
| 65 | /**解析子对象 |
| 66 | * @param index |
| 67 | * @param key |
| 68 | * @param value |
| 69 | * @param cache SQL 结果缓存 |
| 70 | * @return |
| 71 | * @throws Exception |
| 72 | */ |
| 73 | Object onChildParse(int index, String key, M value, Object cache) throws Exception; |
no outgoing calls
no test coverage detected