def GenerateJavaBindingClass(input_dir, bridge_path, bridge_writer, wrapper_path, wrapper_writer): class_loader = JavaClassLoader(input_dir, CLASSES_TO_PROCESS) for input_class in CLASSES_TO_PROCESS: print('Generating bridge and wrapper code for %s.' % input_class) java_data = class_loader.GetJavaData(input_class) if java_data.class_type == 'interface': # Generate Interface code. interface_generator = InterfaceGenerator(java_data, class_loader) interface_generator.RunTask() wrapper_writer.WriteFile( wrapper_path, interface_generator.GetGeneratedClassFileName(), interface_generator.GetGeneratedCode()) else: # Generate Bridge code. bridge_generator = BridgeGenerator(java_data, class_loader) bridge_generator.RunTask() bridge_writer.WriteFile( bridge_path, bridge_generator.GetGeneratedClassFileName(), bridge_generator.GetGeneratedCode()) # Generate Wrapper code. wrapper_generator = WrapperGenerator(java_data, class_loader) wrapper_generator.RunTask() wrapper_writer.WriteFile( wrapper_path, wrapper_generator.GetGeneratedClassFileName(), wrapper_generator.GetGeneratedCode())
def GenerateBindingForJavaDirectory(input_dir, bridge_output, wrap_output): java_class_loader = JavaClassLoader(input_dir, CLASSES_TO_BE_PROCESS) for input_file in os.listdir(input_dir): input_class_name = input_file.replace('.java', '') if java_class_loader.IsInternalClass(input_class_name): # Load all java classes in first. java_data = java_class_loader.LoadJavaClass(input_class_name) print 'Generate bridge and wrapper code for %s' % input_class_name GenerateBindingForJavaClass(java_data, bridge_output, wrap_output, java_class_loader)
def GenerateJavaBindingClass(input_dir): class_loader = JavaClassLoader(input_dir, CLASSES_TO_BE_PROCESS) for input_class in CLASSES_TO_BE_PROCESS: print('Generate bridge and wrapper code for %s' % input_class) java_data = class_loader.GetJavaData(input_class) if java_data.class_type == 'interface': # Generate Interface code. interface_generator = InterfaceGenerator(java_data, class_loader) interface_generator.RunTask() PerformSerialize(wrapper_path, interface_generator) else: # Generate Bridge code. bridge_generator = BridgeGenerator(java_data, class_loader) bridge_generator.RunTask() PerformSerialize(bridge_path, bridge_generator) # Generate Wrapper code. wrapper_generator = WrapperGenerator(java_data, class_loader) wrapper_generator.RunTask() PerformSerialize(wrapper_path, wrapper_generator)