HibernateValidator约束为嵌套对象结构内的字段映射

时间:2020-04-03 04:34:19

标签: java bean-validation nhibernate-validator

我下面有来自第三方jar的java外部类,我想针对该类进行bean验证。

Product.java:

#include <stdio.h>

int main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    int queries[m][3];
    for (int i = 1; i <= m; i++) {
        scanf("%d", &queries[i][1]);
        scanf("%d", &queries[i][2]);
        scanf("%d", &queries[i][3]);
    }

    int a[n];
    for (int i = 1; i <= n; i++)
        a[i] = 0;
    for (int i = 1; i <= m; i++) {
        for (int j = queries[i][1]; j <= queries[i][2]; j++)
            a[j] = a[j] + queries[i][3];
    }

    int max;
    max = 0;
    for (int i = 1; i <= n; i++) {
        if (max < a[i])
            max = a[i];
    }
    printf("%d", max);
    return 0;
}

Price.java

private String id;
private Price price

下面是相同的休眠验证器:

private String price1;
private String price2;

对于价格的嵌套类,验证未按预期进行,非常感谢您的帮助。

0 个答案:

没有答案