ClsCreatoras3代码生成库
ClsCreator 是一个中文的as3代码生成库, 以非常oo, 迅捷, 自动的方式生成需要的代码, 忘掉容易出错, 可维护性又差的模板生成方式吧
Hello world
var cls:Cls = new Cls("HelloWorld", new Pack("")); cls.setSuperClass(new SuperCls(Sprite)); var v:Var = new Var("tea", String); cls.addPropertys(v); var m:Method = new Method("hi", Method.VOID, Property.PUBLIC); m.addStatement(new Statement("trace(\"hello, world\")")); cls.addPropertys(m); trace(cls.toString());
Output
package { import flash.display.Sprite; public class HelloWorld extends Sprite { public var tea:String; public function hi():void { trace("hello, world") } } }
评论