gpt4 book ai didi

java - 带有表情语言的椭圆形

转载 作者:行者123 更新时间:2023-12-01 14:17:39 24 4
gpt4 key购买 nike

我正在使用 Oval http://oval.sourceforge.net/对于 java bean 验证,我在使用表达式语言功能时遇到异常。

我的代码如下所示:

@NotNull(errorCode = "paymentCard.number.invalid", message = "Required", when = "_this.cardType != null")
private String cardNumber;

结果是

WARNING: Cannot determine constraint when formula based on annotation $Proxy10
java.lang.ArrayIndexOutOfBoundsException: 1
at net.sf.oval.AbstractCheck.setWhen(AbstractCheck.java:276)
at net.sf.oval.configuration.annotation.AbstractAnnotationCheck.configure(AbstractAnnotationCheck.java:183)
at net.sf.oval.configuration.annotation.AnnotationsConfigurer.initializeCheck(AnnotationsConfigurer.java:323)
at net.sf.oval.configuration.annotation.AnnotationsConfigurer.configureFieldChecks(AnnotationsConfigurer.java:143)
at net.sf.oval.configuration.annotation.AnnotationsConfigurer.getClassConfiguration(AnnotationsConfigurer.java:294)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
31-Jul-2013 18:04:51 net.sf.oval.internal.Log info
INFO: Available ScriptEngine language names: [[js, rhino, JavaScript, javascript, ECMAScript, ecmascript]]

我不知道为什么会发生这种情况,有人可以帮助我吗?

提前致谢

最佳答案

您需要在公式前加上语言 ID 前缀,例如

when="js:_this.cardType != null"

关于java - 带有表情语言的椭圆形,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17975740/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com