Remove parent type references
[mdsal.git] / binding / mdsal-binding-generator-api / src / main / java / org / opendaylight / mdsal / binding / model / api / Constant.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 /**
11  * Interface Contact is designed to hold and model java constant. In Java there are no constant keywords instead of the
12  * constant is defined as static final field with assigned value. For this purpose the Constant interface contains
13  * methods {@link #getType()} to provide wrapped return Type of Constant, {@link #getName()} the Name of constant and
14  * the {@link #getValue()} for providing of value assigned to Constant. To determine of which type the constant value is
15  * it is recommended firstly to retrieve Type from constant. The Type interface holds base information like java package
16  * name and java type name (e.g. fully qualified name). From this string user should be able to determine to which type
17  * can be {@link #getValue()} type typecasted to unbox and provide value assigned to constant.
18  */
19 public interface Constant {
20     /**
21      * Returns the return Type (or just Type) of the Constant.
22      *
23      * @return the return Type (or just Type) of the Constant.
24      */
25     Type getType();
26
27     /**
28      * Returns the name of constant. <br>
29      * By conventions the name SHOULD be in CAPITALS separated with underscores.
30      *
31      * @return the name of constant.
32      */
33     String getName();
34
35     /**
36      * Returns boxed value that is assigned for context.
37      *
38      * @return boxed value that is assigned for context.
39      */
40     Object getValue();
41
42     /**
43      * Returns Constant definition in formatted string. <br>
44      * <br>
45      * The expected string SHOULD be in format: <code>public final
46      * static [Type] CONSTANT_NAME = [value];</code>
47      *
48      * @return Constant definition in formatted string.
49      */
50     String toFormattedString();
51 }