2 * Copyright (c) 2019 PANTHEON.tech, 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.yang.binding;
10 import com.google.common.annotations.Beta;
11 import java.util.Optional;
14 * Interface mixin for {@link BindingObject}s which can hold additional metadata, as specified by
15 * <a href="https://tools.ietf.org/html/rfc7952">RFC7952</a>. It exposes this metadata as individual annotations via
16 * {@link #annotation(Class)} method. This similar to how {@link Augmentable} works, with the notable difference that
17 * there is no strong tie between an annotation and its bearer object.
20 public interface AnnotationAware {
22 * Returns an instance of a requested annotation type.
24 * @param annotationType Type of annotation to be returned.
25 * @param <A$$> Type capture for augmentation type
26 * @return instance of annotation, or empty if the annotation is not present.
28 // A$$ is an identifier which cannot be generated from models.
29 @SuppressWarnings("checkstyle:methodTypeParameterName")
30 <A$$ extends Annotation<?>> Optional<A$$> annotation(Class<A$$> annotationType);