From 070bfabfd643d2d400067cc35b3a19483fa7b3ac Mon Sep 17 00:00:00 2001 From: delvh Date: Sat, 27 Jun 2020 17:36:03 +0200 Subject: [PATCH] Added a method to get the maximum size allowed for user/ group names --- src/main/java/envoy/util/Bounds.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/envoy/util/Bounds.java b/src/main/java/envoy/util/Bounds.java index 3306fa9..315e047 100644 --- a/src/main/java/envoy/util/Bounds.java +++ b/src/main/java/envoy/util/Bounds.java @@ -8,7 +8,7 @@ import java.util.regex.Pattern; * Project: envoy-common
* File: Bounds.java
* Created: 25.06.2020
- * + * * @author Kai S. K. Engelbart * @since Envoy Common v0.1-beta */ @@ -18,7 +18,7 @@ public class Bounds { /** * The regular expression against which contact names should be validated. - * + * * @since Envoy Common v0.1-beta */ public static final Pattern CONTACT_NAME_PATTERN = Pattern.compile("^\\w[a-zA-Z0-9-]{2,15}$"); @@ -29,4 +29,12 @@ public class Bounds { * @since Envoy Common v0.1-beta */ public static boolean isValidContactName(String contactName) { return CONTACT_NAME_PATTERN.matcher(contactName).matches(); } + + /** + * @return the maximum size allowed for a user/ group name. + * @apiNote has to be updated manually if {@link Bounds#CONTACT_NAME_PATTERN} + * gets updated. + * @since Envoy Common v0.1-beta + */ + public static int maximumUsernameSize() { return 16; } }