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 JGetter class declarations and its functions required
25 * for getting and setting basic data types in C++ and Java
28 #ifndef __JNI_GETTER_H_
29 #define __JNI_GETTER_H_
36 * @brief This class provide utility for get/set basic data types in C++ and Java
42 * This function is called to get String field from the C++ object
45 * JNI Environment reference
47 * JObject from which string field is expected
49 * Name of the field to be extracted from JObject
51 * reference to string value mentioned in fieldName
53 * @return returns true on success and false on failer.
55 static bool getJStringField(JNIEnv *env, jobject &object,
56 const char *fieldName, std::string &value);
59 * This function is called to get Boolean field from the C++ object
62 * JNI Environment reference
64 * JObject from which boolean field is expected
66 * Name of the field to be extracted from JObject
68 * reference to boolean value mentioned in fieldName
70 * @return returns true on success and false on failer.
72 static bool getJBoolField(JNIEnv *env, jobject &object,
73 const char *fieldName, bool &value);
76 * This function is called to get Integer field from the C++ object
79 * JNI Environment reference
81 * JObject from which integer field is expected
83 * Name of the field to be extracted from JObject
85 * reference to integer value mentioned in fieldName
87 * @return returns true on success and false on failer.
89 static bool getJIntField(JNIEnv *env, jobject &object,
90 const char *fieldName, int &value);
93 * This function is called to get Object reference from the C++ object
96 * JNI Environment reference
98 * JObject from which Object reference is expected
100 * Name of the field to be extracted from JObject
102 * Type of the field to be extracted from JObject
104 * reference to Object reference mentioned in fieldName
106 * @return returns true on success and false on failer.
108 static bool getJObjectField(JNIEnv *env, jobject &object,
109 const char *fieldName, const char *fieldType, jobject &value);
111 #endif //__JNI_GETTER_H_