Fix ReactorStmtCtx.calculateParentRefcount()
[yangtools.git] / parser / yang-parser-reactor / src / main / java / org / opendaylight / yangtools / yang / parser / stmt / reactor / SweptNamespace.java
1 /*
2  * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.yangtools.yang.parser.stmt.reactor;
9
10 import static java.util.Objects.requireNonNull;
11
12 import com.google.common.base.VerifyException;
13 import java.util.AbstractMap;
14 import java.util.Set;
15 import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
16
17 /**
18  * Placeholder namespace map which does not allow access and acts as a sentinel for namespaces which have been
19  * explicitly removed from {@link NamespaceStorageSupport}.
20  */
21 final class SweptNamespace extends AbstractMap<Object, Object> {
22     private final ParserNamespace<?, ?> name;
23
24     SweptNamespace(final ParserNamespace<?, ?> name) {
25         this.name = requireNonNull(name);
26     }
27
28     @Override
29     public Set<Entry<Object, Object>> entrySet() {
30         throw new VerifyException("Attempted to access swept namespace " + name);
31     }
32 }