⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bridgeexample.java

📁 Java Pattern Oriented Framework (Jt) 是为了实现Java快速开发的面向模式的框架。
💻 JAVA
字号:


package Jt.examples.patterns;

import Jt.JtBridge;
import Jt.JtFactory;
import Jt.JtMessage;
import Jt.JtObject;
import Jt.examples.HelloWorld;
import Jt.xml.JtXMLHelper;


/**
 * Example of the use of JtBridge.
 */

public class BridgeExample  {



  public BridgeExample () {
  }


  /**
   * Demonstrates the use of JtBridge. It encodes
   * an object using two XML implementations.
   */

  public static void main(String[] args) {

    JtFactory factory = new JtFactory ();
    JtBridge bridge;
    JtObject implementor;
    JtMessage msg;
    HelloWorld hello = new HelloWorld ();
    
    hello.setGreetingMessage("Hello World ...");

    // Create an instance of JtBridge

    bridge = (JtBridge) factory.createObject (JtBridge.JtCLASS_NAME, "bridge");

    // Specify the implementor to be executed.

    implementor = (JtObject) factory.createObject (JtXMLHelper.JtCLASS_NAME);
    bridge.setImplementor(implementor);

    // Encode the object using the XML implemetor selected
    
    msg = new JtMessage (JtObject.JtXML_ENCODE); 
    msg.setMsgContent(hello);
    System.out.println ("Java encoding:" +  factory.sendMessage (bridge, msg));
    
    // Use a different encoding implementation
    
    bridge.setImplementor(new JtObject ());
    
    System.out.println ("Jt encoding:" + factory.sendMessage (bridge, msg));
    
    factory.removeObject ("bridge");


  }

}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -