2 * Copyright (c) 2017 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
9 package org.opendaylight.mdsal.binding.javav2.spec.structural;
11 import com.google.common.annotations.Beta;
12 import com.google.common.collect.ClassToInstanceMap;
15 * Augmentable (extensible) object which could carry additional data defined by third-party
16 * extension, without introducing conflict between various extension.
18 * This interface uses extended version of ExtensibleInterface pattern which also adds marker
19 * interface for augmentations (extensions) - {@link Augmentable}
22 * @param <T> Base class which should implements this interface and is target for augmentation.
25 public interface Augmentable<T> {
28 * Returns instance of augmentation based on class
30 * @param augment Type of augmentation to be returned.
31 * @return instance of augmentation.
33 default <E extends Augmentation<? super T>> E getAugmentation(Class<E> augment) {
34 return augments().getInstance(augment);
39 * Returns map of all instantiated augmentations.
41 * @return Class to Instance Map
43 // REPLACES: BindingReflections#getAugmentations()
44 ClassToInstanceMap<Augmentation<? super T>> augments();