Ejemplo n.º 1
0
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())
Ejemplo n.º 2
0
def GenerateBindingForJavaClass(java_data, bridge_output, wrap_output,
                                class_loader):
    if java_data.class_type == 'interface':
        interface_generator = InterfaceGenerator(java_data, class_loader)
        interface_generator.RunTask()
        PerformSerialize(wrap_output, interface_generator, WRAPPER_PACKAGE)
    else:
        # Generate Bridge code.
        bridge_generator = BridgeGenerator(java_data, class_loader)
        bridge_generator.RunTask()
        # Serialize.
        PerformSerialize(bridge_output, bridge_generator, BRIDGE_PACKAGE)
        # Generate Wrapper code.
        wrapper_generator = WrapperGenerator(java_data, class_loader)
        wrapper_generator.RunTask()
        PerformSerialize(wrap_output, wrapper_generator, WRAPPER_PACKAGE)
Ejemplo n.º 3
0
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)