feat: 修复注解链的bug
This commit is contained in:
parent
39fe3ace5d
commit
73891dca70
@ -65,7 +65,7 @@ public class EmptyAnnotationChain<A extends Annotation, T> extends BasicAnnotati
|
||||
*/
|
||||
@Override
|
||||
public BeanPropertyAnnotationChain<A, T> then(Consumer<T> consumer) {
|
||||
parent.last(false);
|
||||
markParent();
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ public class EmptyAnnotationChain<A extends Annotation, T> extends BasicAnnotati
|
||||
*/
|
||||
@Override
|
||||
public BeanPropertyAnnotationChain<A, T> exists(Runnable handler) {
|
||||
parent.last(false);
|
||||
markParent();
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -135,4 +135,15 @@ public class EmptyAnnotationChain<A extends Annotation, T> extends BasicAnnotati
|
||||
protected BeanPropertyAnnotations cache() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 需要判定之前的值。当我们进入空链,且调用了then,
|
||||
* 代表在没值的时候下次尝试用or时仍可获取值(and总是成立)
|
||||
*/
|
||||
private void markParent() {
|
||||
// 当且仅当链上没有值,才尝试置为false,供后续使用
|
||||
if (null == parent.value()) {
|
||||
parent.last(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user