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

org.neo4j.internal.schema.ReservedSchemaRuleNames Maven / Gradle / Ivy

There is a newer version: 5.26.1
Show newest version
/*
 * Copyright (c) "Neo4j"
 * Neo4j Sweden AB [https://neo4j.com]
 *
 * This file is part of Neo4j.
 *
 * Neo4j is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see .
 */
package org.neo4j.internal.schema;

import static java.util.stream.Collectors.toUnmodifiableSet;

import java.util.Set;
import java.util.stream.Stream;

/**
 * This enum contains names that {@link SchemaRule#getName()} could perhaps return, but which are reserved for current or future internal use.
 * That is, no user, admin or operator can create schema rules with these names.
 */
public enum ReservedSchemaRuleNames {
    /**
     * The name used for NO_INDEX equivalents in pre-4.0 versions.
     */
    UNNAMED_INDEX("Unnamed index"),
    /**
     * Used by {@link IndexDescriptor#NO_INDEX}.
     */
    NO_INDEX(""),

    NO_CONSTRAINT(""), // Reserved for future.
    NO_RULE(""), // Reserved for future.
    NO_SCHEMA(""), // Reserved for future.
    NO_TRIGGER(""), // Reserved for future.
    NO_SEQUENCE(""), // Reserved for future.
    NO_CATALOG(""), // Reserved for future.
    NO_DATABASE(""), // Reserved for future.
    NO_GRAPH(""), // Reserved for future.
    NO_MAP(""), // Reserved for future.
    NO_OBJECT(""); // Reserved for future.

    private static final Set RESERVED_NAMES =
            Stream.of(values()).map(ReservedSchemaRuleNames::getReservedName).collect(toUnmodifiableSet());
    private final String reservedName;

    ReservedSchemaRuleNames(String reservedName) {
        this.reservedName = reservedName;
    }

    public static boolean contains(String name) {
        return RESERVED_NAMES.contains(name);
    }

    public static Set getReservedNames() {
        return RESERVED_NAMES;
    }

    public String getReservedName() {
        return reservedName;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy