2 * Copyright (C) 2015 Roland Haeder
\r
4 * This program is free software: you can redistribute it and/or modify
\r
5 * it under the terms of the GNU General Public License as published by
\r
6 * the Free Software Foundation, either version 3 of the License, or
\r
7 * (at your option) any later version.
\r
9 * This program is distributed in the hope that it will be useful,
\r
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
12 * GNU General Public License for more details.
\r
14 * You should have received a copy of the GNU General Public License
\r
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
\r
17 package org.mxchange.jsfcore.validator.string.names;
\r
19 import java.text.MessageFormat;
\r
20 import javax.faces.component.UIComponent;
\r
21 import javax.faces.context.FacesContext;
\r
22 import javax.faces.validator.Validator;
\r
23 import javax.faces.validator.ValidatorException;
\r
24 import org.mxchange.jsfcore.validator.string.BaseStringValidator;
\r
27 * A validation class for names, such as first name or family name.
\r
29 * @author Roland Haeder
\r
31 public class NameValidator extends BaseStringValidator implements Validator {
\r
33 public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
\r
35 this.getLogger().trace(MessageFormat.format("context={0},component={1},value={2} - CALLED!", context, component, value));
\r
37 // All accepted fields
\r
38 String[] fields = {"firstName", "familyName"};
\r
40 // Pre-validation (e.g. not null, not a string, empty string ...)
\r
41 super.preValidate(context, component, value, fields);
\r
44 this.getLogger().trace("EXIT!");
\r