Seal ItemOrder and MutationBehaviour
[yangtools.git] / common / concepts / src / main / java / org / opendaylight / yangtools / concepts / ExtensibleObject.java
1 /*
2  * Copyright (c) 2019 Pantheon Technologies, 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.concepts;
9
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;
14
15 /**
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>
18  * pattern.
19  *
20  * @param <T> Type of extensible object
21  * @param <E> Extension marker interface
22  * @author Robert Varga
23  */
24 @Beta
25 public interface ExtensibleObject<T extends ExtensibleObject<T, E>, E extends ObjectExtension<T, E>> {
26     /**
27      * Return a map of currently-supported extensions, along with accessor objects which provide access to the specific
28      * functionality bound to this object.
29      *
30      * @return A map of supported functionality.
31      */
32     default @NonNull ClassToInstanceMap<E> getExtensions() {
33         return ImmutableClassToInstanceMap.of();
34     }
35 }