Integrate JavaTypeName as Identifier
[mdsal.git] / binding / mdsal-binding-generator-api / src / main / java / org / opendaylight / mdsal / binding / model / api / type / builder / AnnotableTypeBuilder.java
1 /*
2  * Copyright (c) 2018 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.mdsal.binding.model.api.type.builder;
9
10 import com.google.common.annotations.Beta;
11 import org.opendaylight.mdsal.binding.model.api.JavaTypeName;
12
13 /**
14  * Common interface for java type builders which allow attaching annotations to them.
15  */
16 @Beta
17 public interface AnnotableTypeBuilder {
18     /**
19      * The method creates new {@link AnnotationTypeBuilder} containing specified package name an annotation name.
20      *
21      * @param identifier JavaTypeName of the annotation
22      * @return a new instance of Annotation Type Builder.
23      */
24     AnnotationTypeBuilder addAnnotation(final JavaTypeName identifier);
25
26     /**
27      * The method creates new {@link AnnotationTypeBuilder} containing specified package name an annotation name.
28      * Neither the package name or annotation name can contain <code>null</code> references. In case that any
29      * of parameters contains <code>null</code> the method SHOULD thrown {@link IllegalArgumentException}
30      *
31      * @param packageName Package Name of Annotation Type
32      * @param simpleName Name of Annotation Type
33      * @return <code>new</code> instance of Annotation Type Builder.
34      * @throws NullPointerException if any of the arguments are null
35      * @throws IllegalArgumentException if any of the arguments is an empty string
36      */
37     default AnnotationTypeBuilder addAnnotation(final String packageName, final String simpleName) {
38         return addAnnotation(JavaTypeName.create(packageName, simpleName));
39     }
40 }