1 /******************************************************************
3 * Copyright 2015 Samsung Electronics All Rights Reserved.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 ******************************************************************/
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
28 #ifndef __JNI_SETTER_H_
29 #define __JNI_SETTER_H_
35 * @brief This class provide utility to set data types in C++ object from Java object
42 * This function is called to set Integer field in to C++ object.
45 * JNI Environment reference
47 * JObject to which integer field will be set.
49 * Name of the field to be set in JObject
51 * integer value mentioned in fieldName
53 * @return returns true on success and false on failer.
55 static bool setJIntField(JNIEnv *env, jobject &object,
56 const char *fieldName, int value);
59 * This function is called to set Long field in to C++ object.
62 * JNI Environment reference
64 * JObject to which Long field will be set.
66 * Name of the field to be set in JObject
68 * Long value mentioned in fieldName
70 * @return returns true on success and false on failer.
72 static bool setJLongField(JNIEnv *env, jobject &object,
73 const char *fieldName, jlong value);
76 * This function is called to Set Boolean field to C++ object
79 * JNI Environment reference
81 * JObject to which boolean field has to be set
83 * Name of the field to be set in JObject
85 * boolean value mentioned in fieldName
87 * @return returns true on success and false on failer.
89 static bool setJBoolField(JNIEnv *env, jobject &object,
90 const char *fieldName, bool value);
92 * This function is called to Set String field from the C++ object
95 * JNI Environment reference
97 * JObject in which string value has to be set
99 * Name of the field to be set in JObject
101 * string value mentioned in fieldName
103 * @return returns true on success and false on failer.
105 static bool setJStringField(JNIEnv *env, jobject &object,
106 const char *fieldName, const char *value);
109 * This function is called to set Object reference in C++ object.
112 * JNI Environment reference
114 * JObject to which Object reference is to be set.
116 * Name of the field to be set in JObject
118 * Type of the field to be set in JObject
120 * value of Object mentioned in fieldName
122 * @return returns true on success and false on failer.
124 static bool setJObjectField(JNIEnv *env, jobject &object,
125 const char *fieldName, const char *fieldType, const jobject value);
128 #endif //__JNI_SETTER_H_