2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.yangtools.sal.binding.model.api;
11 * Interface Contact is designed to hold and model java constant. In Java there
12 * are no constant keywords instead of the constant is defined as static final
13 * field with assigned value. For this purpose the Constant interface contains
14 * methods {@link #getType()} to provide wrapped return Type of Constant,
15 * {@link #getName()} the Name of constant and the {@link #getValue()} for
16 * providing of value assigned to Constant. To determine of which type the
17 * constant value is it is recommended firstly to retrieve Type from constant.
18 * The Type interface holds base information like java package name and java
19 * type name (e.g. fully qualified name). From this string user should be able
20 * to determine to which type can be {@link #getValue()} type typecasted to
21 * unbox and provide value assigned to constant.
23 public interface Constant {
26 * Returns the Type that declares constant.
28 * @return the Type that declares constant.
30 Type getDefiningType();
33 * Returns the return Type (or just Type) of the Constant.
35 * @return the return Type (or just Type) of the Constant.
40 * Returns the name of constant. <br>
41 * By conventions the name SHOULD be in CAPITALS separated with underscores.
43 * @return the name of constant.
48 * Returns boxed value that is assigned for context.
50 * @return boxed value that is assigned for context.
55 * Returns Constant definition in formatted string. <br>
57 * The expected string SHOULD be in format: <code>public final
58 * static [Type] CONSTANT_NAME = [value];</code>
60 * @return Constant definition in formatted string.
62 String toFormattedString();