Class V2ParamValidator
java.lang.Object
org.codelibs.fess.api.v2.handlers.V2ParamValidator
Stateless helpers that enforce length/item-count bounds on v2 request
parameters, throwing
InvalidRequestParameterException on violation.-
Method Summary
Modifier and TypeMethodDescriptionstatic String[]checkArray(String[] values, int maxItems, int maxLen, String name) Checks that a string array parameter does not exceed the given item count or per-element length.static StringcheckMaxLength(String value, int max, String name) Checks that a string parameter does not exceed the given maximum length.
-
Method Details
-
checkMaxLength
Checks that a string parameter does not exceed the given maximum length.- Parameters:
value- the parameter value (may benull)max- the maximum allowed length (inclusive)name- the parameter name used in the exception message- Returns:
- the original value, or
nullif the input isnull - Throws:
InvalidRequestParameterException- ifvalue.length() > max
-
checkArray
Checks that a string array parameter does not exceed the given item count or per-element length.- Parameters:
values- the parameter values (may benull)maxItems- the maximum allowed number of values (inclusive)maxLen- the maximum allowed length of each individual value (inclusive)name- the parameter name used in the exception message- Returns:
- the original array, or
nullif the input isnull - Throws:
InvalidRequestParameterException- if the array size or any element length is exceeded
-