2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.yangtools.yang.parser.spi.meta;
10 import com.google.common.base.Preconditions;
12 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
14 @SuppressWarnings("checkstyle:classTypeParameterName")
15 public abstract class DerivedNamespaceBehaviour<K, V, DK, N extends IdentifierNamespace<K, V>,
16 DN extends IdentifierNamespace<DK, ?>> extends NamespaceBehaviour<K, V, N> {
18 private final Class<DN> derivedFrom;
20 protected DerivedNamespaceBehaviour(Class<N> identifier, Class<DN> derivedFrom) {
22 this.derivedFrom = Preconditions.checkNotNull(derivedFrom);
25 public Class<DN> getDerivedFrom() {
30 public Map<K, V> getAllFrom(NamespaceStorageNode storage) {
31 throw new UnsupportedOperationException("Virtual namespaces does not support provision of all items.");
35 public abstract V getFrom(NamespaceBehaviour.NamespaceStorageNode storage, K key);
38 public void addTo(NamespaceStorageNode storage, K key, V value) {
42 public abstract DK getSignificantKey(K key);