开发者

How can i add a toString() function for every class file, automated in Eclipse?

开发者 https://www.devze.com 2022-12-18 13:24 出处:网络
I\'m doing a AS3 project in Eclipse and trace alot of values. I though it would be nice to have a toString() function in every class, at the bottom of each class as the last function, but i dont want

I'm doing a AS3 project in Eclipse and trace alot of values. I though it would be nice to have a toString() function in every class, at the bottom of each class as the last function, but i dont want to do this by hand for 500+ files. Is there a quick and good way of doing this automated?

How would you go about this?

Thanks in ad开发者_运维问答vance,

Sidney


If you have access to the classes the objects were based on, add it there and it will be available to all other classes via inheritance.

If not, then instead of trying to add it to 500 classes you might want to spend the time refactoring and subclass the base object into your own, then have all the classes inherit from that.

The first incarnation will be a simple subclass with your name and the new toString() attached.... Then the next time you need to add functionality you want everywhere you can add it here, recompile and voila, it is available everywhere.

0

精彩评论

暂无评论...
验证码 换一张
取 消