Search in sources :

Example 1 with QueryParam

use of core.framework.api.web.service.QueryParam in project core-ng-project by neowu.

the class QueryParamBeanTypeValidator method visitField.

@Override
public void visitField(Field field, String parentPath) {
    QueryParam queryParam = field.getDeclaredAnnotation(QueryParam.class);
    if (queryParam == null)
        throw Exceptions.error("field must have @QueryParam, field={}", Fields.path(field));
    Property property = field.getDeclaredAnnotation(Property.class);
    if (property != null)
        throw Exceptions.error("field must not have @Property, field={}", Fields.path(field));
    String name = queryParam.name();
    boolean added = visitedQueryParams.add(queryParam.name());
    if (!added) {
        throw Exceptions.error("found duplicate query param, field={}, name={}", Fields.path(field), name);
    }
    Class<?> fieldClass = field.getType();
    if (fieldClass.isEnum()) {
        JSONTypeValidator.validateEnumClass(fieldClass);
    }
}
Also used : QueryParam(core.framework.api.web.service.QueryParam) Property(core.framework.api.json.Property)

Aggregations

Property (core.framework.api.json.Property)1 QueryParam (core.framework.api.web.service.QueryParam)1