|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.opensymphony.xwork2.validator.validators.ValidatorSupport
com.opensymphony.xwork2.validator.validators.FieldValidatorSupport
org.nuiton.validator.xwork2.field.NuitonFieldValidatorSupport
org.nuiton.validator.xwork2.field.FrenchSiretFieldValidator
public class FrenchSiretFieldValidator
Validator for French SIRET numbers
Siret can be in:
| Field Summary | |
|---|---|
protected static Pattern |
p
|
protected static String |
SIRET_REGEXP
|
| Fields inherited from class org.nuiton.validator.xwork2.field.NuitonFieldValidatorSupport |
|---|
skip |
| Fields inherited from class com.opensymphony.xwork2.validator.validators.ValidatorSupport |
|---|
defaultMessage, log, messageKey |
| Constructor Summary | |
|---|---|
FrenchSiretFieldValidator()
|
|
| Method Summary | |
|---|---|
static int |
getDigit(char c)
Converti un char en un entier '0' => 0 et '9' => 9, et 'A' => 10 a 'Z' => 36, les autres caractere sont aussi convertis pour que 'a' = 10 et 'z' = 36. |
String |
getValidatorType()
|
static boolean |
luhnChecksum(String siret)
Verifie la validite d'un numero en suivant l'algorithme Luhn tel que d'ecrit dans wikipedia Algo: en fonction de la position du numero dans la sequence, on multiplie pas 1 (pour les impaires) ou par 2 pour les paires (1 etant le numero le plus a droite) On fait la somme de tous les chiffres qui resulte de ces multiplications (si un resultat etait 14, on ne fait pas +14 mais +1+4) Si le résultat de cette somme donne un reste de 0 une fois divisé par 10 le numero est valide. |
void |
validateWhenNotSkip(Object object)
Method to be invoked when skip parameter was not evaludated to true. |
| Methods inherited from class org.nuiton.validator.xwork2.field.NuitonFieldValidatorSupport |
|---|
evaluateSkipParameter, getFieldValue, setSkip, validate |
| Methods inherited from class com.opensymphony.xwork2.validator.validators.FieldValidatorSupport |
|---|
getFieldName, setFieldName, setValidatorType |
| Methods inherited from class com.opensymphony.xwork2.validator.validators.ValidatorSupport |
|---|
addActionError, addFieldError, conditionalParse, getDefaultMessage, getMessage, getMessageKey, getMessageParameters, getParse, getValidatorContext, isShortCircuit, setDefaultMessage, setMessageKey, setMessageParameters, setParse, setShortCircuit, setValidatorContext, setValueStack |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.opensymphony.xwork2.validator.Validator |
|---|
getDefaultMessage, getMessage, getMessageKey, getMessageParameters, getValidatorContext, setDefaultMessage, setMessageKey, setMessageParameters, setValidatorContext, setValueStack |
| Field Detail |
|---|
protected static final String SIRET_REGEXP
protected static final Pattern p
| Constructor Detail |
|---|
public FrenchSiretFieldValidator()
| Method Detail |
|---|
public void validateWhenNotSkip(Object object) throws com.opensymphony.xwork2.validator.ValidationException
NuitonFieldValidatorSupporttrue.
validateWhenNotSkip in class NuitonFieldValidatorSupportobject - the object to be validated.
com.opensymphony.xwork2.validator.ValidationException - is thrown if there is validation error(s).public String getValidatorType()
getValidatorType in interface com.opensymphony.xwork2.validator.ValidatorgetValidatorType in class com.opensymphony.xwork2.validator.validators.FieldValidatorSupportpublic static boolean luhnChecksum(String siret)
siret - une chaine composer que de chiffre
public static int getDigit(char c)
c - le caractere qui doit etre converti
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||