Added @NotNull annotations for IdentifierValidator

This commit is contained in:
Andrey Terentev 2024-03-11 21:01:13 +07:00 committed by Andrey Terentev
parent 5ceeb6c893
commit c89f5c3511

View File

@ -1,18 +1,20 @@
package ru.dragonestia.picker.api.util; package ru.dragonestia.picker.api.util;
import org.jetbrains.annotations.NotNull;
public class IdentifierValidator { public class IdentifierValidator {
private IdentifierValidator() {} private IdentifierValidator() {}
public static boolean forNode(String nodeId) { public static boolean forNode(@NotNull String nodeId) {
return nodeId.matches("^(?!-)[a-z\\d-]{0,31}[a-z\\d](?!-)$"); return nodeId.matches("^(?!-)[a-z\\d-]{0,31}[a-z\\d](?!-)$");
} }
public static boolean forRoom(String roomId) { public static boolean forRoom(@NotNull String roomId) {
return roomId.matches("^(?!-)[a-z\\d-]{0,31}[a-z\\d](?!-)$"); return roomId.matches("^(?!-)[a-z\\d-]{0,31}[a-z\\d](?!-)$");
} }
public static boolean forUser(String username) { public static boolean forUser(@NotNull String username) {
return username.matches("^[aA-zZ\\d-.\\s:@_;]{1,64}$"); return username.matches("^[aA-zZ\\d-.\\s:@_;]{1,64}$");
} }
} }