1 package de.example.symfony.validator.service.impl;
5 import de.example.symfony.validator.ValidatorNumber;
6 import de.example.symfony.validator.ValidatorString;
7 import de.example.symfony.validator.service.ValidatorService;
10 public class ValidatorServiceImpl extends ValidatorService {
11 private static final String FROMID = "fromId";
12 private static final String TOID = "toId";
13 private static final String DESCRIPTION = "description";
15 private String fromId;
17 private String description;
19 public ValidatorServiceImpl(Map<String, String> params) {
24 protected void configureValidators() {
25 validators.put(FROMID, new ValidatorNumber.Builder().setRequired(true).setMin(5).build());
26 validators.put(TOID, new ValidatorNumber.Builder().setRequired(true).setMax(100).build());
27 validators.put(DESCRIPTION, new ValidatorString.Builder().setRequired(false).setMaxLength(70).setMinLength(5).build());
31 protected void configurePostValidators() {
33 postValidators.put(FROMID, value ->
36 System.out.println("fromId: " + fromId);
39 postValidators.put(TOID, value ->
42 System.out.println("toId: " + toId);
46 postValidators.put(DESCRIPTION, value ->
49 System.out.println("description: " + description);