opengoofy/crane4j

`@MethodContainer` 支持指定是否忽略空集合,或者集合中为 null 的参数

Closed this issue · 0 comments

希望 @MethodContainer 可以支持指定是否忽略空集合,或者集合中为 null 的参数,比如:

@ContainerMethod(
    namespace = "test",
    ignoreNullKey = true, // 如果 ids 中存在 null 的 key,则将其过滤
    ignoreIfEmpty = true, // 如果入参的 ids 集合为空(如果设置的过滤,则先过滤再检测)则忽略此次调用
)
public List<Foo> listByIds(Set<Integer> ids) {
    // do something
}

在上述代码配置中,如果设置了 ignoreNullKey 为 true,则会自动过滤入参的 ids 集合中为 null 的 key。如果设置了 ignoreIfEmpty,则若 ids 集合为空,将会直接返回空数据,不会再调用方法。