Update License text
[vnfsdk/compliance.git] / veslibrary / ves_javalibrary / evel_javalib2 / src / evel_javalibrary / att / com / EvelOptionString.java
1 package evel_javalibrary.att.com;\r
2 /**************************************************************************//**\r
3  * @file\r
4  * Evel Option String class\r
5  *\r
6  * This file implements the Evel Option class to handle optional String fields.\r
7  *\r
8  * License\r
9  * -------\r
10  * Unless otherwise specified, all software contained herein is\r
11   * Licensed under the Apache License, Version 2.0 (the "License");\r
12  * you may not use this file except in compliance with the License.\r
13  * You may obtain a copy of the License at\r
14  *        http://www.apache.org/licenses/LICENSE-2.0\r
15  *\r
16  * Unless required by applicable law or agreed to in writing, software\r
17  * distributed under the License is distributed on an "AS IS" BASIS,\r
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
19  * See the License for the specific language governing permissions and\r
20  * limitations under the License.\r
21  *****************************************************************************/\r
22 \r
23 import javax.json.JsonObjectBuilder;\r
24 \r
25 import org.apache.log4j.Logger;\r
26 /*\r
27  * Handles Optional String fields\r
28  */\r
29 public class EvelOptionString extends EvelOption {\r
30 \r
31         /**************************************************************************//**\r
32          * Optional parameter holder for string.\r
33          *****************************************************************************/\r
34      String value;\r
35      \r
36      private static final Logger LOGGER = Logger.getLogger( EvelOptionString.class.getName() );\r
37      \r
38          public EvelOptionString()\r
39          {\r
40                  super(false);\r
41                  value = null;\r
42          }\r
43          \r
44          public EvelOptionString(boolean val, String str)\r
45          {\r
46                  super(val);\r
47                  value = str;\r
48          }\r
49          \r
50          public void InitValue()\r
51          {\r
52                  is_set = false;\r
53                  value = null;\r
54          }\r
55          //Setter\r
56          public void SetValue(String str)\r
57          {\r
58                  is_set = true;\r
59                  value = str;\r
60          }\r
61          \r
62         //Sets String value outputting debugging message\r
63          public void SetValuePr(String str, String mstr)\r
64          {\r
65                  \r
66                  is_set = true;\r
67                  value = str;   \r
68                  LOGGER.debug("Setting "+mstr+" to "+str);\r
69          }\r
70          //Getter\r
71          public String GetValue()\r
72          {\r
73                  return value;\r
74          }\r
75          /*\r
76           * Encoding JSON function\r
77           * @retval boolean returns option true if object is encoded\r
78           * with String value\r
79           */\r
80          public boolean encJsonValue(JsonObjectBuilder obj, String name)\r
81          {\r
82                  if( is_set ) obj.add(name, value);\r
83                  return is_set;\r
84          }\r
85 \r
86 }\r
87 \r
88         \r