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 ******************************************************************/
23 * This file contains the JGetter class declarations and its functions required
24 * for getting and setting basic data types in C++ and Java.
34 * This class provide utility for get/set basic data types in C++ and Java.
40 * This function is called to get String field from the C++ object.
43 * JNI Environment reference
45 * JObject from which string field is expected
47 * Name of the field to be extracted from JObject
49 * reference to string value mentioned in fieldName
51 * @return returns true on success and false on failer.
53 static bool getJStringField(JNIEnv *env, jobject &object, const char *fieldName,
57 * This function is called to get Boolean field from the C++ object.
60 * JNI Environment reference
62 * JObject from which boolean field is expected
64 * Name of the field to be extracted from JObject
66 * reference to boolean value mentioned in fieldName
68 * @return returns true on success and false on failer.
70 static bool getJBoolField(JNIEnv *env, jobject &object, const char *fieldName,
74 * This function is called to get Integer field from the C++ object.
77 * JNI Environment reference
79 * JObject from which integer field is expected
81 * Name of the field to be extracted from JObject
83 * reference to integer value mentioned in fieldName
85 * @return returns true on success and false on failer.
87 static bool getJIntField(JNIEnv *env, jobject &object, const char *fieldName, int &value);
90 * This function is called to get Object reference from the C++ object.
93 * JNI Environment reference
95 * JObject from which Object reference is expected
97 * Name of the field to be extracted from JObject
99 * Type of the field to be extracted from JObject
101 * reference to Object reference mentioned in fieldName
103 * @return returns true on success and false on failure
105 static bool getJObjectField(JNIEnv *env, jobject &object, const char *fieldName,
106 const char *fieldType, jobject &value);
108 #endif //JNI_GETTER_H_