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

📄 codewizard.java

📁 基于Java开发的Data Object自动生成器
💻 JAVA
字号:
// Copyright 2000-2001, Hansky Inc. All Rights Reserved.// Confidential and Propritary Information of Hansky, Inc.// @(#)CodeWizard.java, 1.0, 03/27/2001package com.hansky.tools.codewizard;import java.io.*;import java.util.*;import com.hansky.util.*;import com.hansky.chtml.*;/** * A base class for code wizard.  It will read a template file, fill in the * values, and generate a new java file. * * @author	Kaiyang Liu * @version	1.0, 03/27/2001 */abstract public class CodeWizard {    ChFile tpl;    OutputStream out;    FileProps props;    HashMap values;    String outputPath;    public CodeWizard() {	values = new HashMap();    }    public void start(String tplPath, String valuePath, String outputPath) throws IOException {	this.outputPath = outputPath;	tpl = new ChFile(tplPath);	tpl.parse(new File(tplPath));	if (outputPath == null) {	    out = System.out;	} else {	    out = new BufferedOutputStream(new FileOutputStream(outputPath, true), 4096);	}	props = new FileProps(new File(valuePath));	doit();	PrintWriter pw = new PrintWriter(out);	tpl.evaluate(pw, values);	pw.flush();	close();    }    abstract protected void doit();     public void printValue(String s) {	String v = props.getProperty(s);	values.put(s, v);    }    void close() throws IOException {	if (outputPath != null) {	    out.close();	}    }        public void start(String argv[]) throws IOException {	if (argv.length < 4) {	    System.out.println("usage: this -tpl filename -value filename -o output");	    return;	}		String tpl = null;	String output = null;	String value = null;		for (int i = 0; i < argv.length; i++) {	    String s = argv[i];	    	    if ("-tpl".equals(s)) {		tpl = argv[++i];	    } else if ("-o".equals(s)) {		output = argv[++i];	    } else if ("-value".equals(s)) {		value = argv[++i];	    }	}	start(tpl, value, output);    }}

⌨️ 快捷键说明

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