2 * Copyright (c) 2019 Pantheon Technologies, s.r.o. 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.concepts;
10 import com.google.common.annotations.Beta;
11 import com.google.common.collect.ClassToInstanceMap;
12 import com.google.common.collect.ImmutableClassToInstanceMap;
13 import org.eclipse.jdt.annotation.NonNull;
16 * Interface specifying access to extensions attached to a particular object. This functionality is loosely based on
17 * <a href="https://docs.microsoft.com/en-us/dotnet/framework/wcf/extending/extensible-objects">Extensible Object</a>
20 * @param <T> Type of extensible object
21 * @param <E> Extension marker interface
22 * @author Robert Varga
25 public interface ExtensibleObject<T extends ExtensibleObject<T, E>, E extends ObjectExtension<T, E>> {
27 * Return a map of currently-supported extensions, along with accessor objects which provide access to the specific
28 * functionality bound to this object.
30 * @return A map of supported functionality.
32 default @NonNull ClassToInstanceMap<E> getExtensions() {
33 return ImmutableClassToInstanceMap.of();