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_
37 * @brief This class provide utility for get/set basic data types in C++ and Java
44 * This function is called to get String field from the C++ object
47 * JNI Environment reference
49 * JObject from which string field is expected
51 * Name of the field to be extracted from JObject
53 * reference to string value mentioned in fieldName
55 * @return returns true on success and false on failer.
57 static bool getJStringField(JNIEnv *env, jobject &object, const char *fieldName,
61 * This function is called to get Boolean field from the C++ object
64 * JNI Environment reference
66 * JObject from which boolean field is expected
68 * Name of the field to be extracted from JObject
70 * reference to boolean value mentioned in fieldName
72 * @return returns true on success and false on failer.
74 static bool getJBoolField(JNIEnv *env, jobject &object, const char *fieldName,
78 * This function is called to get Integer field from the C++ object
81 * JNI Environment reference
83 * JObject from which integer field is expected
85 * Name of the field to be extracted from JObject
87 * reference to integer value mentioned in fieldName
89 * @return returns true on success and false on failer.
91 static bool getJIntField(JNIEnv *env, jobject &object, const char *fieldName, int &value);
94 * This function is called to get Object reference from the C++ object
97 * JNI Environment reference
99 * JObject from which Object reference is expected
101 * Name of the field to be extracted from JObject
103 * Type of the field to be extracted from JObject
105 * reference to Object reference mentioned in fieldName
107 * @return returns true on success and false on failer.
109 static bool getJObjectField(JNIEnv *env, jobject &object, const char *fieldName,
110 const char *fieldType, jobject &value);
112 #endif //__JNI_GETTER_H_