Correct @NonNull CodeHelpers.compilePatterns()
[mdsal.git] / binding / yang-binding / src / main / java / org / opendaylight / yangtools / yang / binding / AnnotationAware.java
1 /*
2  * Copyright (c) 2019 PANTHEON.tech, 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.yang.binding;
9
10 import com.google.common.annotations.Beta;
11 import java.util.Optional;
12
13 /**
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.
18  */
19 @Beta
20 public interface AnnotationAware {
21     /**
22      * Returns an instance of a requested annotation type.
23      *
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.
27      */
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);
31 }