Extended binding-model-api to support of Enclosed Generated Types and TOs.
[controller.git] / opendaylight / sal / yang-prototype / code-generator / binding-model-api / src / main / java / org / opendaylight / controller / sal / binding / model / api / Constant.java
1 /*\r
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
3  *\r
4  * This program and the accompanying materials are made available under the\r
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
6  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
7  */\r
8 package org.opendaylight.controller.sal.binding.model.api;\r
9 \r
10 /**\r
11  * Interface Contact is designed to hold and model java constant. In Java\r
12  * there are no constant keywords instead of the constant is defined as\r
13  * static final field with assigned value. For this purpose the Constant\r
14  * interface contains methods {@link #getType()} to provide wrapped return\r
15  * Type of Constant, {@link #getName()} the Name of constant and the {@link\r
16  * #getValue()} for providing of value assigned to Constant. To determine of\r
17  * which type the constant value is it is recommended firstly to retrieve\r
18  * Type from constant. The Type interface holds base information like java\r
19  * package name and java type name (e.g. fully qualified name). From this\r
20  * string user should be able to determine to which type can be {@link\r
21  * #getValue()} type typecasted to unbox and provide value assigned to\r
22  * constant.\r
23  */\r
24 public interface Constant {\r
25 \r
26     /**\r
27      * Returns the Type that declares constant.\r
28      *\r
29      * @return the Type that declares constant.\r
30      */\r
31     public Type getDefiningType();\r
32 \r
33     /**\r
34      * Returns the return Type (or just Type) of the Constant.\r
35      *\r
36      * @return the return Type (or just Type) of the Constant.\r
37      */\r
38     public Type getType();\r
39 \r
40     /**\r
41      * Returns the name of constant.\r
42      * <br>\r
43      * By conventions the name SHOULD be in CAPITALS separated with\r
44      * underscores.\r
45      *\r
46      * @return the name of constant.\r
47      */\r
48     public String getName();\r
49 \r
50     /**\r
51      * Returns boxed value that is assigned for context.\r
52      *\r
53      * @return boxed value that is assigned for context.\r
54      */\r
55     public Object getValue();\r
56 \r
57     /**\r
58      * Returns Constant definition in formatted string.\r
59      * <br>\r
60      * <br>\r
61      * The expected string SHOULD be in format: <code>public final\r
62      * static [Type] CONSTANT_NAME = [value];</code>\r
63      *\r
64      * @return Constant definition in formatted string.\r
65      */\r
66     public String toFormattedString();\r
67 }\r