Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.
public final class Violations
- Object
- Violations
Collects the
FieldErrors of one request. The generated validation code
calls it; an application has no reason to.Constructors
public Violations() |
Methods
Inherited methods
Constructor details
Violations
public Violations()Method details
add
public void add(String field, String code, String message, String fallback)Records one failure.
Parameters
fieldString- the path
codeString- the constraint’s simple name
messageString- the declared message, or empty for
fallback fallbackString- the default message
errors
public List<FieldError> errors()What was recorded so far.
Returns
the errors, possibly empty
check
public void check()Throws a
ValidationException when anything was recorded.path
public static String path(String prefix, String name)prefix.name, or name at the root.Parameters
prefixString- the parent path, empty at the root
nameString- the property
Returns
the path
index
public static String index(String prefix, int index)prefix[index].Parameters
prefixString- the collection’s path
indexint- the element
Returns
the path
isBlank
public static boolean isBlank(CharSequence s)Whether
s is null or only whitespace.Parameters
sCharSequence- the value
Returns
true when blank