Revert "Change build option - IP only"
[platform/upstream/iotivity.git] / service / easy-setup / sdk / mediator / android / jni / jniutil / inc / jni_setter.h
1 /******************************************************************
2  *
3  * Copyright 2015 Samsung Electronics All Rights Reserved.
4  *
5  *
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  ******************************************************************/
20
21 /**
22  * @file   jni_setter.h
23  *
24  * @brief  This file contains the JSetter class declarations and and its functions required
25  *            to set data types in C++ object from Java object
26  */
27
28 #ifndef __JNI_SETTER_H_
29 #define __JNI_SETTER_H_
30
31 #include <jni.h>
32
33 /**
34  * @class   JSetter
35  * @brief  This class provide utility to set data types in C++ object from Java object
36  *
37  */
38 class JSetter {
39 public:
40
41         /**
42          * This function is called to set Integer field in to C++ object.
43          *
44          * @param env
45          *           JNI Environment reference
46          * @param object
47          *           JObject to which integer field will be set.
48          * @param fieldName
49          *           Name of the field to be set in JObject
50          * @param value
51          *         integer value mentioned in fieldName
52          *
53          * @return returns true on success and false on failer.
54          */
55         static bool setJIntField(JNIEnv *env, jobject &object,
56                         const char *fieldName, int value);
57
58         /**
59          * This function is called to set Long field in to C++ object.
60          *
61          * @param env
62          *           JNI Environment reference
63          * @param object
64          *           JObject to which Long field will be set.
65          * @param fieldName
66          *           Name of the field to be set in JObject
67          * @param value
68          *         Long value mentioned in fieldName
69          *
70          * @return returns true on success and false on failer.
71          */
72         static bool setJLongField(JNIEnv *env, jobject &object,
73                         const char *fieldName, jlong value);
74
75         /**
76          * This function is called to Set Boolean field to C++ object
77          *
78          * @param env
79          *           JNI Environment reference
80          * @param object
81          *           JObject to which boolean field has to be set
82          * @param fieldName
83          *           Name of the field to be set in JObject
84          * @param value
85          *         boolean value mentioned in fieldName
86          *
87          * @return returns true on success and false on failer.
88          */
89         static bool setJBoolField(JNIEnv *env, jobject &object,
90                         const char *fieldName, bool value);
91         /**
92          * This function is called to Set String field from the C++ object
93          *
94          * @param env
95          *           JNI Environment reference
96          * @param object
97          *           JObject in which string value has to be set
98          * @param fieldName
99          *           Name of the field to be set in JObject
100          * @param value
101          *         string value mentioned in fieldName
102          *
103          * @return returns true on success and false on failer.
104          */
105         static bool setJStringField(JNIEnv *env, jobject &object,
106                         const char *fieldName, const char *value);
107
108         /**
109          * This function is called to set Object reference in C++ object.
110          *
111          * @param env
112          *           JNI Environment reference
113          * @param object
114          *           JObject to which Object reference is to be set.
115          * @param fieldName
116          *           Name of the field to be set in JObject
117          * @param fieldType
118          *           Type of the field to be set in JObject
119          * @param value
120          *         value of Object mentioned in fieldName
121          *
122          * @return returns true on success and false on failer.
123          */
124         static bool setJObjectField(JNIEnv *env, jobject &object,
125                         const char *fieldName, const char *fieldType, const jobject value);
126 };
127
128 #endif //__JNI_SETTER_H_