X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fsal%2Fyang-prototype%2Fcode-generator%2Fbinding-model-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fbinding%2Fmodel%2Fapi%2FConstant.java;h=921a4733410a0a32e93de193f24245abeaa82682;hp=cad3460913d3d178759936dd67a9ea6c29a445e9;hb=f607c4b0b922281f1ddd5fda2e7b49ca67d26ecd;hpb=42210c03b0a4c54706320ba9f55794c0abd4d201 diff --git a/opendaylight/sal/yang-prototype/code-generator/binding-model-api/src/main/java/org/opendaylight/controller/sal/binding/model/api/Constant.java b/opendaylight/sal/yang-prototype/code-generator/binding-model-api/src/main/java/org/opendaylight/controller/sal/binding/model/api/Constant.java index cad3460913..921a473341 100644 --- a/opendaylight/sal/yang-prototype/code-generator/binding-model-api/src/main/java/org/opendaylight/controller/sal/binding/model/api/Constant.java +++ b/opendaylight/sal/yang-prototype/code-generator/binding-model-api/src/main/java/org/opendaylight/controller/sal/binding/model/api/Constant.java @@ -7,15 +7,61 @@ */ package org.opendaylight.controller.sal.binding.model.api; +/** + * Interface Contact is designed to hold and model java constant. In Java + * there are no constant keywords instead of the constant is defined as + * static final field with assigned value. For this purpose the Constant + * interface contains methods {@link #getType()} to provide wrapped return + * Type of Constant, {@link #getName()} the Name of constant and the {@link + * #getValue()} for providing of value assigned to Constant. To determine of + * which type the constant value is it is recommended firstly to retrieve + * Type from constant. The Type interface holds base information like java + * package name and java type name (e.g. fully qualified name). From this + * string user should be able to determine to which type can be {@link + * #getValue()} type typecasted to unbox and provide value assigned to + * constant. + */ public interface Constant { + /** + * Returns the Type that declares constant. + * + * @return the Type that declares constant. + */ public Type getDefiningType(); + /** + * Returns the return Type (or just Type) of the Constant. + * + * @return the return Type (or just Type) of the Constant. + */ public Type getType(); + /** + * Returns the name of constant. + *
+ * By conventions the name SHOULD be in CAPITALS separated with + * underscores. + * + * @return the name of constant. + */ public String getName(); + /** + * Returns boxed value that is assigned for context. + * + * @return boxed value that is assigned for context. + */ public Object getValue(); + /** + * Returns Constant definition in formatted string. + *
+ *
+ * The expected string SHOULD be in format: public final + * static [Type] CONSTANT_NAME = [value]; + * + * @return Constant definition in formatted string. + */ public String toFormattedString(); }