]> git.mxchange.org Git - jphone-core.git/blob - src/org/mxchange/jphone/validators/PhoneNumberValidator.java
75c36b9248ab55a8c3d68942b0948cf0b1a17ed1
[jphone-core.git] / src / org / mxchange / jphone / validators / PhoneNumberValidator.java
1 /*
2  * Copyright (C) 2016 Roland Häder
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 package org.mxchange.jphone.validators;
18
19 import javax.faces.component.UIComponent;
20 import javax.faces.context.FacesContext;
21 import javax.faces.validator.FacesValidator;
22 import javax.faces.validator.Validator;
23 import org.mxchange.jcoreee.validator.number.BaseLongValidator;
24
25 /**
26  * A validator for phone, fax and mobile numbers
27  * <p>
28  * @author Roland Häder<roland@mxchange.org>
29  * @deprecated Please copy this class to your project, it won't load.
30  */
31 @FacesValidator (value = "PhoneNumberValidator")
32 @Deprecated
33 public class PhoneNumberValidator extends BaseLongValidator implements Validator {
34
35         /**
36          * Serial number
37          */
38         private static final long serialVersionUID = 186_897_817_692_786_900L;
39
40         @Override
41         public void validate (final FacesContext context, final UIComponent component, final Object value) {
42                 // Trace message
43                 //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N
44
45                 // The required field
46                 String[] requiredFields = {"phoneAreaCode", "phoneNumber", "faxAreaCode", "faxNumber", "cellphoneNumber"}; //NOI18N
47
48                 // Pre-validation (example: not null, not a string, empty string ...)
49                 super.preValidate(context, component, value, requiredFields, true);
50
51                 // Trace message
52                 //* NOISY-DEBUG: */ System.out.println("validate: EXIT!"); //NOI18N
53         }
54
55 }