Adding C and Java VES Vendor libs
[vnfsdk/compliance.git] / veslibrary / ves_javalibrary / evel_javalib2 / src / evel_javalibrary / att / com / EvelOptionTime.java
1 package evel_javalibrary.att.com;\r
2 /**************************************************************************//**\r
3  * @file\r
4  * Evel Option Time class\r
5  *\r
6  * This file implements the Evel Option Time class to handle optional time fields.\r
7  *\r
8  * License\r
9  * -------\r
10  *\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 java.util.Date;\r
24 \r
25 import javax.json.JsonObjectBuilder;\r
26 import javax.json.JsonValue;\r
27 \r
28 import org.apache.log4j.Logger;\r
29 /*\r
30  * Handles Optional Date/Time fields\r
31  */\r
32 public class EvelOptionTime extends EvelOption {\r
33 \r
34         /**************************************************************************//**\r
35          * Optional parameter holder for string.\r
36          *****************************************************************************/\r
37      Date value;\r
38      \r
39      private static final Logger LOGGER = Logger.getLogger( EvelOptionTime.class.getName() );\r
40      \r
41          public EvelOptionTime()\r
42          {\r
43                  super(false);\r
44                  value = null;\r
45          }\r
46      \r
47          public EvelOptionTime(boolean val, Date str)\r
48          {\r
49                  super(val);\r
50                  value = str;\r
51          }\r
52          \r
53          public void InitValue()\r
54          {\r
55                  is_set = false;\r
56                  value = null;\r
57          }\r
58          //Setter\r
59          public void SetValue(Date str)\r
60          {\r
61                  is_set = true;\r
62                  value = str;\r
63          }\r
64          \r
65         //Sets Date value outputting debugging message\r
66          public void SetValuePr(Date str, String mstr)\r
67          {\r
68                  \r
69                  is_set = true;\r
70                  value = str;   \r
71                  LOGGER.debug("Setting "+mstr+" to "+str);\r
72          }\r
73          \r
74          public Date GetValue()\r
75          {\r
76                  return value;\r
77          }\r
78          /*\r
79           * Encoding JSON function\r
80           * @retval boolean returns option true if object is encoded\r
81           * with Date value\r
82           */     \r
83          public boolean encJsonValue(JsonObjectBuilder obj, String name)\r
84          {\r
85                  if( is_set ) obj.add(name, (JsonValue) value);\r
86                  return is_set;\r
87          }\r
88 \r
89 }\r
90 \r
91         \r