All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.memority.citadel.shared.api.im.ObjectId Maven / Gradle / Ivy

Go to download

This artifact provides the API classes that are necessary to implement general configuration Rules on the Memority IM platform.

There is a newer version: 3.43.1
Show newest version
/*
 * 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();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy