/*
- * Copyright (C) 2015 Roland Haeder
+ * Copyright (C) 2016 Roland Haeder
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
+ */
package org.mxchange.jcoreee.validator.string.names;
-import java.text.MessageFormat;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import javax.faces.validator.FacesValidator;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
import org.mxchange.jcoreee.validator.string.BaseStringValidator;
/**
* A validation class for names, such as first name or family name.
- *
- * @author Roland Haeder
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
*/
+@FacesValidator (value = "NameValidator")
public class NameValidator extends BaseStringValidator implements Validator {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 27_587_896_710_689_451L;
+
@Override
public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
// Trace message
- this.getLogger().logTrace(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N
+ //this.getLogger().logTrace(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N
// All accepted, required fields
String[] requiredFileds = {"firstName", "familyName", "city", "street"}; //NOI18N
- // Pre-validation (e.g. not null, not a string, empty string ...)
- super.preValidate(context, component, value, requiredFileds);
+ // Pre-validation (example: not null, not a string, empty string ...)
+ super.preValidate(context, component, value, requiredFileds, true);
// Trace message
- this.getLogger().logTrace("validate: EXIT!"); //NOI18N
+ //this.getLogger().logTrace("validate: EXIT!"); //NOI18N
}
}