|
| 1 | +/* |
| 2 | + * Copyright (C) 2009-2019 Slava Semushin <[email protected]> |
| 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 2 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, write to the Free Software |
| 16 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | + */ |
| 18 | +package ru.mystamps.web.feature.country; |
| 19 | + |
| 20 | +import ru.mystamps.web.feature.country.CountryDb.Country; |
| 21 | + |
| 22 | +// @todo #927 CountryValidation: remove COUNTRY_ prefix from the constants |
| 23 | +@SuppressWarnings("PMD.CommentDefaultAccessModifier") |
| 24 | +public final class CountryValidation { |
| 25 | + |
| 26 | + public static final int COUNTRY_NAME_MIN_LENGTH = 3; |
| 27 | + public static final int COUNTRY_NAME_MAX_LENGTH = Country.NAME_LENGTH; |
| 28 | + public static final String COUNTRY_NAME_EN_REGEXP = "[- a-zA-Z]+"; |
| 29 | + public static final String COUNTRY_NAME_RU_REGEXP = "[- а-яёА-ЯЁ]+"; |
| 30 | + static final String COUNTRY_NAME_NO_HYPHEN_REGEXP = "[ \\p{L}]([- \\p{L}]+[ \\p{L}])*"; |
| 31 | + @SuppressWarnings("PMD.LongVariable") |
| 32 | + static final String COUNTRY_NAME_NO_REPEATING_HYPHENS_REGEXP = "(?!.+[-]{2,}).+"; |
| 33 | + |
| 34 | + private CountryValidation() { |
| 35 | + } |
| 36 | + |
| 37 | +} |
| 38 | + |
0 commit comments