-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
提供回调接口或组件,用于在具体的填充过程支持一些自定的操作 #79
Labels
enhancement
New feature or request
worth trying
Features or improvements that are worth trying but not necessarily achievable
Milestone
Comments
Closed
Createsequence
added
the
worth trying
Features or improvements that are worth trying but not necessarily achievable
label
Jul 6, 2023
2023-07-11 补充: |
Createsequence
changed the title
提供操作拦截器,用于在具体的填充过程支持一些自定的操作
提供回调接口或组件,用于在具体的填充过程支持一些自定的操作
Jan 20, 2024
目前想到了一个比较好的办法,那就是像 Spring 一个提供一个 比如: @Accessors(chain = true)
@Data
private static class Bean implements SmartOperationAware {
@Assemble(groups = {"op", "id"})
private Integer id;
private String name;
@Assemble(groups = {"op", "key"})
private Integer key;
private String value;
@Disassemble(type = NestedBean.class, groups = "op")
private NestedBean nestedBean;
@Override
public boolean supportOperation(KeyTriggerOperation operation) {
// 执行装配或拆卸操作前,检查是否要真正的应用这个操作
return true;
}
@Override
public void beforeAssembleOperation() {
// 在拆卸操作完成后,装配操作开始前执行
}
@Override
public void beforeAssembleOperation(BeanOperations operations) {
// 在拆卸操作完成后,装配操作开始前执行
}
@Override
public void afterOperationsCompletion(BeanOperations operations) {
// 在所有的操作完成后执行
}
@Override
public void afterOperationsCompletion() {
// 在所有的操作完成后执行
}
} 在操作执行器执行的过程中,判断一下这个对象是不是实现了 |
Createsequence
added a commit
that referenced
this issue
Jan 20, 2024
…cific action steps (GitHub #79)
Createsequence
added a commit
that referenced
this issue
Jan 20, 2024
…cific action steps (GitHub #79)
This was referenced Jan 31, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
New feature or request
worth trying
Features or improvements that are worth trying but not necessarily achievable
有时候,当我们配置好操作时,比如:
实际上这个
gender
很有可能并不是直接把根据 id 关联出来的对象的 gender 属性搬过来就完了,有可能还会有一些别的操作,比如:List<Integer>
,我只想取首个元素再转字符串,这显然不能指望靠类型转换器解决;上述两个例子可能不够恰当,严格来说它们都算追加操作,但是要表达是意思是一样的:“当获取到了关联的对象后,我希望能够做些除了属性映射以外的事情”,#5 想要的效果其实就是这个。
目前比较好的思路是给个
AssembleOperation
以及DisassembleOperatiopn
加一个interceptors
,它可能是绑定在:target
和source
对象;target
和source
对象,以及两者要映射的属性值;比较迷茫的点是:
OperationHandler
功能是不是有部分重叠?PropertyOperator
的功能是不是有部分重叠?这个功能肯定是要的,因为公司现在就遇到了这样的需求,但是到底要怎么样比较好的基于现有代码实现,这就是个问题了。
The text was updated successfully, but these errors were encountered: