1 19 35 36 import java.io.*; 37 import java.util.*; 38 import org.w3c.dom.*; 39 40 import mycar.*; 41 42 43 public class TestExtension2 extends BaseTest { 44 public static void main(String [] argv) { 45 TestExtension2 o = new TestExtension2(); 46 if (argv.length > 0) 47 o.setDocumentDir(argv[0]); 48 try { 49 o.run(); 50 } catch (Exception e) { 51 e.printStackTrace(); 52 System.exit(1); 53 } 54 System.exit(0); 55 } 56 57 public void run() throws Exception { 58 Mycar extension; 59 60 this.readDocument(); 61 62 out("creating the bean graph"); 63 extension = Mycar.read(doc); 64 65 out("bean graph created"); 67 extension.write(out); 68 Object extensionObject = extension; 69 if (extensionObject instanceof Vehicle) 70 out("Mycar is a vehicle"); if (extensionObject instanceof Boat) 72 out("Mycar is a boat"); } 74 } 75 | Popular Tags |