def setter_impl(self):
        if self.var_type == VarType.cpp_string:
            impl = '-(void)set{0}:(NSString *){1} {{\n'.format(string_utils.first_char_to_upper(self.__objc_name()), self.__objc_name())
            impl += _OBJC_SPACE
            impl += '_coreHandle->set_{0}([{1} UTF8String]);\n'.format(self.name, self.__objc_name())
            impl += '}'
            return impl
        elif self.var_type == VarType.cpp_string_array:
            impl = '-(void)set{0}:(NSArray<NSString *> *){1} {{\n'.format(string_utils.first_char_to_upper(self.__objc_name()), self.__objc_name())
            impl += _OBJC_SPACE
            impl += '_coreHandle->set_{0}([LCCObjcAdapter stringVectorsFromArrayOfNSString:{1}]);\n'.format(self.name, self.__objc_name())
            impl += '}'
            return impl
        else:
            impl = '-(void)set{1}:({0}){2} {{\n'\
                .format(self.var_type.to_objc_getter_string(),
                        string_utils.first_char_to_upper(self.__objc_name()),
                        self.__objc_name())
            impl += _OBJC_SPACE

            var_type_str = ''
            if self.var_type == VarType.cpp_int:
                var_type_str += '(int)'
            elif self.var_type == VarType.cpp_enum:
                var_type_str += '(lesschat::{0})'.format(self.var_type.cpp_enum_type_string())

            impl += '_coreHandle->set_{0}({1}{2});\n'.format(self.name, var_type_str, self.__objc_name())
            impl += '}'
            return impl
    def jni_delete_local_ref(self):
        """Gets JNI delete local ref method.

        Returns:
            A string which is JNI delete local ref method.
        """
        if self.__var_type == VarType.cpp_string or self.__var_type == VarType.cpp_string_array:
            return 'env->DeleteLocalRef(j{0});'.format(string_utils.first_char_to_upper(self.__name))
        elif self.__var_type == VarType.cpp_object or self.__var_type == VarType.cpp_object_array:
            skr_logger.skr_log_warning('JniVariable.jni_delete_local_ref() : Not supported type')
            return 'env->DeleteLocalRef(j{0});'.format(string_utils.first_char_to_upper(self.__name))
        else:
            return ''
    def jni_delete_local_ref(self):
        """Gets JNI delete local ref method.

        Returns:
            A string which is JNI delete local ref method.
        """
        if self.__var_type == VarType.cpp_string or self.__var_type == VarType.cpp_string_array:
            return 'env->DeleteLocalRef(j{0});'.format(
                string_utils.first_char_to_upper(self.__name))
        elif self.__var_type == VarType.cpp_object or self.__var_type == VarType.cpp_object_array:
            skr_logger.skr_log_warning(
                'JniVariable.jni_delete_local_ref() : Not supported type')
            return 'env->DeleteLocalRef(j{0});'.format(
                string_utils.first_char_to_upper(self.__name))
        else:
            return ''
Exemple #4
0
 def __web_api_declaration(self, api):
     declaration = ''
     declaration += '- (void){0}'.format(
         string_utils.first_char_to_lower(api.alias))
     if len(api.input_var_list) > 0:
         if len(api.input_var_list) == 1:
             declaration += 'By'
         else:
             declaration += 'With'
         for i, input_var in enumerate(api.input_var_list):
             input_name = string_utils.to_objc_property_name(input_var.name)
             if i == 0:
                 input_name = string_utils.first_char_to_upper(input_name)
             declaration += '{0}:({1}){2} '.format(
                 input_name, input_var.var_type.to_objc_getter_string(),
                 string_utils.first_char_to_lower(input_name))
         declaration += 'success:(void (^)('
     else:
         declaration += 'Success:(void (^)('
     if len(api.output_var_list) > 0:
         for i, output_var in enumerate(api.output_var_list):
             declaration += output_var.var_type.to_objc_getter_string()
             declaration += string_utils.to_objc_property_name(
                 output_var.name)
             if i != len(api.output_var_list) - 1:
                 declaration += ', '
     declaration += '))successBlock failure:(void (^)(NSError *error))failureBlock'
     return declaration
 def getter_impl(self):
     if self.var_type == VarType.cpp_bool:
         impl = '-(BOOL)is{0} {{\n'.format(
             string_utils.first_char_to_upper(self.__objc_name()))
         impl += _OBJC_SPACE
         impl += 'return _coreHandle->is_{0}();\n'.format(self.name)
         impl += '}'
         return impl
     elif self.var_type == VarType.cpp_string:
         impl = '-(NSString *){0} {{\n'.format(self.__objc_name())
         impl += _OBJC_SPACE
         impl += 'return [NSString stringWithUTF8String:_coreHandle->{0}().c_str()];\n'.format(
             self.name)
         impl += '}'
         return impl
     elif self.var_type == VarType.cpp_string_array:
         impl = '-(NSArray<NSString *> *){0} {{\n'.format(
             self.__objc_name())
         impl += _OBJC_SPACE
         impl += 'return [LCCObjcAdapter objcArrayOfNSStringFromStringVector:_coreHandle->{0}()];\n'.format(
             self.name)
         impl += '}'
         return impl
     else:
         impl = '-({0}){1} {{\n'.format(
             self.var_type.to_objc_getter_string(), self.__objc_name())
         impl += _OBJC_SPACE
         impl += 'return ({0})_coreHandle->{1}();\n'.format(
             self.var_type.to_objc_getter_string(), self.name)
         impl += '}'
         return impl
 def __web_api_declaration(self, api, config):
     declaration = ''
     declaration += '- (void){0}'.format(string_utils.first_char_to_lower(api.alias))
     if len(api.input_var_list) > 0:
             if len(api.input_var_list) == 1:
                 declaration += 'By'
             else:
                 declaration += 'With'
             for i, input_var in enumerate(api.input_var_list):
                 input_name = string_utils.to_objc_property_name(input_var.name)
                 if i == 0:
                     input_name = string_utils.first_char_to_upper(input_name)
                 declaration += '{0}:({1}){2} '.format(input_name,
                                                       input_var.var_type.to_objc_getter_string(config),
                                                       string_utils.first_char_to_lower(input_name))
             declaration += 'success:(void (^)('
     else:
         declaration += 'Success:(void (^)('
     if len(api.output_var_list) > 0:
         for i, output_var in enumerate(api.output_var_list):
             declaration += output_var.var_type.to_objc_getter_string(config)
             declaration += string_utils.to_objc_property_name(output_var.name)
             if i != len(api.output_var_list) - 1:
                 declaration += ', '
     declaration += '))successBlock failure:(void (^)(NSError *error))failureBlock'
     return declaration
    def getter_impl(self, config):
        """Returns Objective-C++ property getter implementation.

        Args:
            config: A <Config> object provides user-defined info.

        Returns:
            A string which is Objective-C++ property getter implementation.
        """
        if self.var_type == VarType.cpp_bool:
            impl = '-(BOOL)is{0} {{\n'.format(string_utils.first_char_to_upper(self.__objc_name()))
            impl += _OBJC_SPACE
            impl += 'return _coreHandle->is_{0}();\n'.format(self.name)
            impl += '}'
            return impl
        elif self.var_type == VarType.cpp_string:
            impl = '-(NSString *){0} {{\n'.format(self.__objc_name())
            impl += _OBJC_SPACE
            impl += 'return [NSString stringWithUTF8String:_coreHandle->{0}().c_str()];\n'.format(self.name)
            impl += '}'
            return impl
        elif self.var_type == VarType.cpp_string_array:
            impl = '-(NSArray<NSString *> *){0} {{\n'.format(self.__objc_name())
            impl += _OBJC_SPACE
            impl += 'return [LCCObjcAdapter objcArrayOfNSStringFromStringVector:_coreHandle->{0}()];\n'.format(self.name)
            impl += '}'
            return impl
        else:
            impl = '-({0}){1} {{\n'.format(self.var_type.to_objc_getter_string(config), self.__objc_name())
            impl += _OBJC_SPACE
            impl += 'return ({0})_coreHandle->{1}();\n'.format(self.var_type.to_objc_getter_string(config), self.name)
            impl += '}'
            return impl
 def getter_impl(self):
     if self.var_type == VarType.cpp_bool:
         impl = '-(BOOL)is{0} {{\n'.format(string_utils.first_char_to_upper(self.__objc_name()))
         impl += _OBJC_SPACE
         impl += 'return _coreHandle->is_{0}();\n'.format(self.name)
         impl += '}'
         return impl
     elif self.var_type == VarType.cpp_string:
         impl = '-(NSString *){0} {{\n'.format(self.__objc_name())
         impl += _OBJC_SPACE
         impl += 'return [NSString stringWithUTF8String:_coreHandle->{0}().c_str()];\n'.format(self.name)
         impl += '}'
         return impl
     elif self.var_type == VarType.cpp_string_array:
         impl = '-(NSArray<NSString *> *){0} {{\n'.format(self.__objc_name())
         impl += _OBJC_SPACE
         impl += 'return [LCCObjcAdapter objcArrayOfNSStringFromStringVector:_coreHandle->{0}()];\n'.format(self.name)
         impl += '}'
         return impl
     else:
         impl = '-({0}){1} {{\n'.format(self.var_type.to_objc_getter_string(), self.__objc_name())
         impl += _OBJC_SPACE
         impl += 'return ({0})_coreHandle->{1}();\n'.format(self.var_type.to_objc_getter_string(), self.name)
         impl += '}'
         return impl
 def __http_response_listener(self, api):
     listener_name = ''
     if len(api.output_var_list) != 0:
         listener_name += 'On{0}Listener'.format(
             string_utils.first_char_to_upper(api.function_name))
     else:
         listener_name += 'OnResponseListener'
     return listener_name
Exemple #10
0
    def setter_impl(self, config):
        """Returns Objective-C++ property setter implementation.

        Args:
            config: A <Config> object provides user-defined info.

        Returns:
            A string which is Objective-C++ property setter implementation.
        """
        if self.var_type == VarType.cpp_string:
            impl = '-(void)set{0}:(NSString *){1} {{\n'.format(
                string_utils.first_char_to_upper(self.__objc_name()),
                self.__objc_name())
            impl += _OBJC_SPACE
            impl += '_coreHandle->set_{0}([{1} UTF8String]);\n'.format(
                self.name, self.__objc_name())
            impl += '}'
            return impl
        elif self.var_type == VarType.cpp_string_array:
            impl = '-(void)set{0}:(NSArray<NSString *> *){1} {{\n'\
                .format(string_utils.first_char_to_upper(self.__objc_name()),
                        self.__objc_name())
            impl += _OBJC_SPACE
            impl += '_coreHandle->set_{0}([LCCObjcAdapter stringVectorsFromArrayOfNSString:{1}]);\n'\
                .format(self.name, self.__objc_name())
            impl += '}'
            return impl
        else:
            impl = '-(void)set{1}:({0}){2} {{\n'\
                .format(self.var_type.to_objc_getter_string(config),
                        string_utils.first_char_to_upper(self.__objc_name()),
                        self.__objc_name())
            impl += _OBJC_SPACE

            var_type_str = ''
            if self.var_type == VarType.cpp_int:
                var_type_str += '(int)'
            elif self.var_type == VarType.cpp_enum:
                var_type_str += '({1}::{0})'.format(
                    self.var_type.cpp_enum_type_string(), config.cpp_namespace)

            impl += '_coreHandle->set_{0}({1}{2});\n'.format(
                self.name, var_type_str, self.__objc_name())
            impl += '}'
            return impl
 def property(self):
     if self.var_type == VarType.cpp_bool:
         return '@property (nonatomic, getter=is{1}) BOOL {0};'.format(
             self.__objc_name(),
             string_utils.first_char_to_upper(self.__objc_name()))
     elif self.var_type == VarType.cpp_string or self.var_type == VarType.cpp_string_array:
         return '@property (nonatomic, copy) {0}{1};'.format(
             self.var_type.to_objc_getter_string(), self.__objc_name())
     else:
         return '@property (nonatomic) {0} {1};'.format(
             self.var_type.to_objc_getter_string(), self.__objc_name())
    def setter_impl(self, config):
        """Returns Objective-C++ property setter implementation.

        Args:
            config: A <Config> object provides user-defined info.

        Returns:
            A string which is Objective-C++ property setter implementation.
        """
        if self.var_type == VarType.cpp_string:
            impl = '-(void)set{0}:(NSString *){1} {{\n'.format(string_utils.first_char_to_upper(self.__objc_name()),
                                                               self.__objc_name())
            impl += _OBJC_SPACE
            impl += '_coreHandle->set_{0}([{1} UTF8String]);\n'.format(self.name, self.__objc_name())
            impl += '}'
            return impl
        elif self.var_type == VarType.cpp_string_array:
            impl = '-(void)set{0}:(NSArray<NSString *> *){1} {{\n'\
                .format(string_utils.first_char_to_upper(self.__objc_name()),
                        self.__objc_name())
            impl += _OBJC_SPACE
            impl += '_coreHandle->set_{0}([LCCObjcAdapter stringVectorsFromArrayOfNSString:{1}]);\n'\
                .format(self.name, self.__objc_name())
            impl += '}'
            return impl
        else:
            impl = '-(void)set{1}:({0}){2} {{\n'\
                .format(self.var_type.to_objc_getter_string(config),
                        string_utils.first_char_to_upper(self.__objc_name()),
                        self.__objc_name())
            impl += _OBJC_SPACE

            var_type_str = ''
            if self.var_type == VarType.cpp_int:
                var_type_str += '(int)'
            elif self.var_type == VarType.cpp_enum:
                var_type_str += '({1}::{0})'.format(self.var_type.cpp_enum_type_string(), config.cpp_namespace)

            impl += '_coreHandle->set_{0}({1}{2});\n'.format(self.name, var_type_str, self.__objc_name())
            impl += '}'
            return impl
 def __http_listener(self, api):
     http_listener = indent(4) + '@FunctionalInterface' + '\n'
     function_name = string_utils.first_char_to_upper(api.function_name)
     http_listener += indent(
         4) + 'public interface On{0}Listener {{'.format(
             function_name) + '\n'
     http_listener += indent(8) + 'void on{0}('.format(function_name)
     http_listener += self.__output_variable_declaration_v2(
         api.output_var_list)
     http_listener += ');' + '\n'
     http_listener += indent(4) + '}'
     return http_listener
    def __jni_get_jobject_by_core_object_implementation(self, config):
        impl = 'jobject JniHelper::GetJ{0}ByCore{0}(const lesschat::{0}& {1}) {{\n'.format(
            self.__class_name, string_utils.cpp_class_name_to_cpp_file_name(self.__class_name))
        impl += indent(2) + 'JNIEnv* env = GetJniEnv();\n'
        impl += indent(2) + 'if (!env) {\n'
        impl += indent(4) + 'sakura::log_error("Failed to get JNIEnv");\n'
        impl += indent(4) + 'return nullptr;\n'
        impl += indent(2) + '}\n\n'
        impl += indent(2) + 'jclass {0}Jclass = JniReferenceCache::SharedCache()->{1}_jclass();\n'.format(
            string_utils.first_char_to_lower(self.__class_name),
            string_utils.cpp_class_name_to_cpp_file_name(self.__class_name))
        impl += indent(2) + 'jmethodID {0}ConstructorMethodID = env->GetMethodID({0}Jclass, "<init>", "('.format(
            string_utils.first_char_to_lower(self.__class_name))
        for jni_var in self.__jni_var_list:
            impl += jni_var.var_type.to_jni_signature()
        impl += ')V");\n\n'

        for jni_var in self.__jni_var_list:
            impl += indent(2) + jni_var.jni_var_assignment_by_cpp_variable(config) + '\n'

        impl += '\n'

        constructor_fst_line = indent(2) + 'jobject j{0}Object = env->NewObject('.format(self.__class_name)
        num_constructor_indent = len(constructor_fst_line)

        impl += constructor_fst_line

        parameters = []
        jclass_instance_name = '{0}Jclass'.format(string_utils.first_char_to_lower(self.__class_name))
        constructor_method_id = '{0}ConstructorMethodID'.format(string_utils.first_char_to_lower(self.__class_name))
        parameters.append(constructor_method_id)
        for jni_var in self.__jni_var_list:
            parameters.append('j{0}'.format(string_utils.first_char_to_upper(jni_var.name)))

        impl += jclass_instance_name + ',\n'
        for parameter in parameters:
            impl += indent(num_constructor_indent) + parameter + ',\n'
        impl = impl[:-2]
        impl += ');'
        impl += '\n'

        for jni_var in self.__jni_var_list:
            delete_method = jni_var.jni_delete_local_ref()
            if delete_method != '':
                impl += indent(2) + delete_method + '\n'
        impl += '\n'

        impl += indent(2) + 'return j{0}Object;'.format(self.__class_name)
        impl += '\n'
        impl += '}\n'
        impl += '\n'
        return impl
    def setter_impl(self):
        if self.var_type == VarType.cpp_string:
            impl = '-(void)set{0}:(NSString *){1} {{\n'.format(
                string_utils.first_char_to_upper(self.__objc_name()),
                self.__objc_name())
            impl += _OBJC_SPACE
            impl += '_coreHandle->set_{0}([{1} UTF8String]);\n'.format(
                self.name, self.__objc_name())
            impl += '}'
            return impl
        elif self.var_type == VarType.cpp_string_array:
            impl = '-(void)set{0}:(NSArray<NSString *> *){1} {{\n'.format(
                string_utils.first_char_to_upper(self.__objc_name()),
                self.__objc_name())
            impl += _OBJC_SPACE
            impl += '_coreHandle->set_{0}([LCCObjcAdapter stringVectorsFromArrayOfNSString:{1}]);\n'.format(
                self.name, self.__objc_name())
            impl += '}'
            return impl
        else:
            impl = '-(void)set{1}:({0}){2} {{\n'\
                .format(self.var_type.to_objc_getter_string(),
                        string_utils.first_char_to_upper(self.__objc_name()),
                        self.__objc_name())
            impl += _OBJC_SPACE

            var_type_str = ''
            if self.var_type == VarType.cpp_int:
                var_type_str += '(int)'
            elif self.var_type == VarType.cpp_enum:
                var_type_str += '(lesschat::{0})'.format(
                    self.var_type.cpp_enum_type_string())

            impl += '_coreHandle->set_{0}({1}{2});\n'.format(
                self.name, var_type_str, self.__objc_name())
            impl += '}'
            return impl
    def property(self, config):
        """Returns Objective-C++ property declaration.

        Args:
            config: A <Config> object provides user-defined info.

        Returns:

        """
        if self.var_type == VarType.cpp_bool:
            return '@property (nonatomic, getter=is{1}) BOOL {0};'\
                .format(self.__objc_name(), string_utils.first_char_to_upper(self.__objc_name()))
        elif self.var_type == VarType.cpp_string or self.var_type == VarType.cpp_string_array:
            return '@property (nonatomic, copy) {0}{1};'.format(self.var_type.to_objc_getter_string(config),
                                                                self.__objc_name())
        else:
            return '@property (nonatomic) {0} {1};'.format(self.var_type.to_objc_getter_string(config),
                                                           self.__objc_name())
 def __convert_bys_to_string(self, by_string_list):
     if len(by_string_list) == 0:  # empty string
         return ''
     else:  # "(const std::string& id, const std::string& username)"
         bys_string = 'By'
         it = 0
         for by_string in by_string_list:
             objc_var = self.__objc_var_by_name(by_string)
             if objc_var is not None:
                 if it == 0:
                     bys_string += string_utils.first_char_to_upper(objc_var.parameter()) + ' '
                 else:
                     bys_string += objc_var.parameter() + ' '
                 it += 1
             else:
                 print 'Unknown "{0}" in "by"'.format(by_string)
                 return ''
         bys_string = bys_string[:-1]
         return bys_string
Exemple #18
0
    def property(self, config):
        """Returns Objective-C++ property declaration.

        Args:
            config: A <Config> object provides user-defined info.

        Returns:

        """
        if self.var_type == VarType.cpp_bool:
            return '@property (nonatomic, getter=is{1}) BOOL {0};'\
                .format(self.__objc_name(), string_utils.first_char_to_upper(self.__objc_name()))
        elif self.var_type == VarType.cpp_string or self.var_type == VarType.cpp_string_array:
            return '@property (nonatomic, copy) {0}{1};'.format(
                self.var_type.to_objc_getter_string(config),
                self.__objc_name())
        else:
            return '@property (nonatomic) {0} {1};'.format(
                self.var_type.to_objc_getter_string(config),
                self.__objc_name())
Exemple #19
0
 def __convert_bys_to_string(self, by_string_list):
     if len(by_string_list) == 0:  # empty string
         return ''
     else:  # "(const std::string& id, const std::string& username)"
         bys_string = 'By'
         it = 0
         for by_string in by_string_list:
             objc_var = self.__objc_var_by_name(by_string)
             if objc_var is not None:
                 if it == 0:
                     bys_string += string_utils.first_char_to_upper(
                         objc_var.parameter()) + ' '
                 else:
                     bys_string += objc_var.parameter() + ' '
                 it += 1
             else:
                 print 'Unknown "{0}" in "by"'.format(by_string)
                 return ''
         bys_string = bys_string[:-1]
         return bys_string
Exemple #20
0
    def getter_impl(self, config):
        """Returns Objective-C++ property getter implementation.

        Args:
            config: A <Config> object provides user-defined info.

        Returns:
            A string which is Objective-C++ property getter implementation.
        """
        if self.var_type == VarType.cpp_bool:
            impl = '-(BOOL)is{0} {{\n'.format(
                string_utils.first_char_to_upper(self.__objc_name()))
            impl += _OBJC_SPACE
            impl += 'return _coreHandle->is_{0}();\n'.format(self.name)
            impl += '}'
            return impl
        elif self.var_type == VarType.cpp_string:
            impl = '-(NSString *){0} {{\n'.format(self.__objc_name())
            impl += _OBJC_SPACE
            impl += 'return [NSString stringWithUTF8String:_coreHandle->{0}().c_str()];\n'.format(
                self.name)
            impl += '}'
            return impl
        elif self.var_type == VarType.cpp_string_array:
            impl = '-(NSArray<NSString *> *){0} {{\n'.format(
                self.__objc_name())
            impl += _OBJC_SPACE
            impl += 'return [LCCObjcAdapter objcArrayOfNSStringFromStringVector:_coreHandle->{0}()];\n'.format(
                self.name)
            impl += '}'
            return impl
        else:
            impl = '-({0}){1} {{\n'.format(
                self.var_type.to_objc_getter_string(config),
                self.__objc_name())
            impl += _OBJC_SPACE
            impl += 'return ({0})_coreHandle->{1}();\n'.format(
                self.var_type.to_objc_getter_string(config), self.name)
            impl += '}'
            return impl
Exemple #21
0
    def __jni_get_jobject_by_core_object_implementation(self, config):
        impl = 'jobject JniHelper::GetJ{0}ByCore{0}(const lesschat::{0}& {1}) {{\n'.format(
            self.__class_name,
            string_utils.cpp_class_name_to_cpp_file_name(self.__class_name))
        impl += indent(2) + 'JNIEnv* env = GetJniEnv();\n'
        impl += indent(2) + 'if (!env) {\n'
        impl += indent(4) + 'sakura::log_error("Failed to get JNIEnv");\n'
        impl += indent(4) + 'return nullptr;\n'
        impl += indent(2) + '}\n\n'
        impl += indent(
            2
        ) + 'jclass {0}Jclass = JniReferenceCache::SharedCache()->{1}_jclass();\n'.format(
            string_utils.first_char_to_lower(self.__class_name),
            string_utils.cpp_class_name_to_cpp_file_name(self.__class_name))
        impl += indent(
            2
        ) + 'jmethodID {0}ConstructorMethodID = env->GetMethodID({0}Jclass, "<init>", "('.format(
            string_utils.first_char_to_lower(self.__class_name))
        for jni_var in self.__jni_var_list:
            impl += jni_var.var_type.to_jni_signature()
        impl += ')V");\n\n'

        for jni_var in self.__jni_var_list:
            impl += indent(2) + jni_var.jni_var_assignment_by_cpp_variable(
                config) + '\n'

        impl += '\n'

        constructor_fst_line = indent(
            2) + 'jobject j{0}Object = env->NewObject('.format(
                self.__class_name)
        num_constructor_indent = len(constructor_fst_line)

        impl += constructor_fst_line

        parameters = []
        jclass_instance_name = '{0}Jclass'.format(
            string_utils.first_char_to_lower(self.__class_name))
        constructor_method_id = '{0}ConstructorMethodID'.format(
            string_utils.first_char_to_lower(self.__class_name))
        parameters.append(constructor_method_id)
        for jni_var in self.__jni_var_list:
            parameters.append('j{0}'.format(
                string_utils.first_char_to_upper(jni_var.name)))

        impl += jclass_instance_name + ',\n'
        for parameter in parameters:
            impl += indent(num_constructor_indent) + parameter + ',\n'
        impl = impl[:-2]
        impl += ');'
        impl += '\n'

        for jni_var in self.__jni_var_list:
            delete_method = jni_var.jni_delete_local_ref()
            if delete_method != '':
                impl += indent(2) + delete_method + '\n'
        impl += '\n'

        impl += indent(2) + 'return j{0}Object;'.format(self.__class_name)
        impl += '\n'
        impl += '}\n'
        impl += '\n'
        return impl
 def property(self):
     if self.var_type == VarType.cpp_bool:
         return '@property (nonatomic, getter=is{1}) BOOL {0};'.format(self.__objc_name(), string_utils.first_char_to_upper(self.__objc_name()))
     elif self.var_type == VarType.cpp_string or self.var_type == VarType.cpp_string_array:
         return '@property (nonatomic, copy) {0}{1};'.format(self.var_type.to_objc_getter_string(), self.__objc_name())
     else:
         return '@property (nonatomic) {0} {1};'.format(self.var_type.to_objc_getter_string(), self.__objc_name())