private static void validateSizeProperty(
            Size size,
            Object value,
            Field field,
            List<String> errorMessages) {
        int min = size.min();
        int max = size.max();
        int count = -1;
        String propertyLengthName = null;
        if (value instanceof String str) {
            count = str.length();
            propertyLengthName = "length";
        } else if (value instanceof Collection<?> collection) {
            count = collection.size();
            propertyLengthName = "size";
        } else if (value instanceof Map<?, ?> map) {
            count = map.size();
            propertyLengthName = "size";
        }
        if (count == -1) {
            throw new IllegalArgumentException(
                    "The field \""
                            + field
                            + "\" must be a string, collection, or map for size validation");
        }
        if (min > count) {
            String message = "The "
                    + propertyLengthName
                    + " of property \""
                    + field.getName()
                    + "\" must be greater than or equal to "
                    + min;
            errorMessages.add(message);
        }
        if (max < count) {
            String message = "The "
                    + propertyLengthName
                    + " of property \""
                    + field.getName()
                    + "\" must be less than or equal to "
                    + max;
            errorMessages.add(message);
        }
    }
@implNote We don't use "hibernate-validator" because it has a terrible performance
turms-server-common/src/main/java/im/turms/server/common/infra/property/TurmsPropertiesValidator.java