2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
\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
8 package org.opendaylight.controller.sal.binding.model.api;
\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
24 public interface Constant {
\r
27 * Returns the Type that declares constant.
\r
29 * @return the Type that declares constant.
\r
31 public Type getDefiningType();
\r
34 * Returns the return Type (or just Type) of the Constant.
\r
36 * @return the return Type (or just Type) of the Constant.
\r
38 public Type getType();
\r
41 * Returns the name of constant.
\r
43 * By conventions the name SHOULD be in CAPITALS separated with
\r
46 * @return the name of constant.
\r
48 public String getName();
\r
51 * Returns boxed value that is assigned for context.
\r
53 * @return boxed value that is assigned for context.
\r
55 public Object getValue();
\r
58 * Returns Constant definition in formatted string.
\r
61 * The expected string SHOULD be in format: <code>public final
\r
62 * static [Type] CONSTANT_NAME = [value];</code>
\r
64 * @return Constant definition in formatted string.
\r
66 public String toFormattedString();
\r