Do not use ListenerRegistration
[mdsal.git] / binding / mdsal-binding-model-api / src / main / java / org / opendaylight / mdsal / binding / model / api / AnnotationType.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. 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;
9
10 import java.util.List;
11
12 /**
13  * The Annotation Type interface is designed to hold information about annotation for any type that could be annotated
14  * in Java.<br>
15  * For sake of simplicity the Annotation Type is not designed to model exact behaviour of annotation mechanism,
16  * but just to hold information needed to model annotation over java Type definition.
17  */
18 public interface AnnotationType extends Type {
19     /**
20      * Returns the List of Annotations. Each Annotation Type MAY have defined multiple Annotations.
21      *
22      * @return the List of Annotations.
23      */
24     List<AnnotationType> getAnnotations();
25
26     /**
27      * Returns Parameter Definition assigned for given parameter name. If Annotation does not contain parameter
28      * with specified param name, the method MAY return <code>null</code> value.
29      *
30      * @param paramName Parameter Name
31      * @return Parameter Definition assigned for given parameter name.
32      */
33     Parameter getParameter(String paramName);
34
35     /**
36      * Returns List of all parameters assigned to Annotation Type.
37      *
38      * @return List of all parameters assigned to Annotation Type.
39      */
40     List<Parameter> getParameters();
41
42     /**
43      * Returns List of parameter names.
44      *
45      * @return List of parameter names.
46      */
47     List<String> getParameterNames();
48
49     /**
50      * Returns <code>true</code> if annotation contains parameters.
51      *
52      * @return <code>true</code> if annotation contains parameters.
53      */
54     boolean containsParameters();
55
56     /**
57      * Annotation Type parameter interface. For simplicity the Parameter contains values and value types as Strings.
58      * Every annotation which contains parameters could contain either single parameter or array of parameters. To model
59      * this purposes the by contract if the parameter contains single parameter the {@link #getValues()} method will
60      * return empty List and {@link #getValue()} MUST always return non-<code>null</code> parameter. If the Parameter
61      * holds List of values the singular {@link #getValue()} parameter MAY return <code>null</code> value.
62      */
63     interface Parameter {
64         /**
65          * Returns the Name of the parameter.
66          *
67          * @return the Name of the parameter.
68          */
69         String getName();
70
71         /**
72          * Returns value in String format if Parameter contains singular value, otherwise MAY return <code>null</code>.
73          *
74          * @return value in String format if Parameter contains singular value.
75          */
76         String getValue();
77
78         /**
79          * Returns List of Parameter assigned values in order in which they were assigned for given parameter name.<br>
80          * If there are multiple values assigned for given parameter name the method MUST NOT return empty List.
81          *
82          * @return List of Parameter assigned values in order in which they were assigned for given parameter name.
83          */
84         List<String> getValues();
85     }
86 }