com.memority.citadel.shared.api.im.ObjectId Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of citadel-api Show documentation
Show all versions of citadel-api Show documentation
This artifact provides the API classes that are necessary to implement general configuration Rules on the Memority IM platform.
/*
* Copyright (c) 2016-2023 Memority. All Rights Reserved.
*
* This file is part of Memority Citadel API , a Memority project.
*
* This file is released under the Memority Public Artifacts End-User License Agreement,
* see
* Unauthorized copying of this file, via any medium is strictly prohibited.
*/
package com.memority.citadel.shared.api.im;
import java.util.regex.Pattern;
/**
* An object identifier. This also holds the information about the object's kind.
*/
public interface ObjectId extends BaseId {
/**
* The Regular Expression that all Object Identifiers must respect: [a-zA-Z0-9\-_.$=+#@][a-zA-Z0-9\-_.$=+#@~]{0,254}
*/
Pattern ID_REGEX_PATTERN = Pattern.compile("[a-zA-Z0-9\\-_.$=+#@][a-zA-Z0-9\\-_.$=+#@~]{0,254}");
ObjectKind getKind();
default boolean isValid() {
return ID_REGEX_PATTERN.matcher(this.getValue()).matches();
}
/**
* @param id the id to test
* @return true
if the given string is a valid identifier, false
otherwise
*/
static boolean isValidId(String id) {
return id != null && ID_REGEX_PATTERN.matcher(id).matches();
}
}