admin管理员组文章数量:1313162
I am working on a project that must generate Java code for use with a BeanShell interpreter. The past convention involved creating a regular Java class and manually copying and pasting the applicable parts into a BeanShell script and deploying it.
For obvious reasons, I wrote a small script to parse the required sections based on region comments and write them all out to the BeanShell script file.
For example (excluding the additional data to handle unindenting):
//region
import java.util.UUID;
//endRegion
public class Foo {
public static void main(String[] args)
{
//region
System.out.println(UUID.randomUUID().toString());
//endRegion
}
}
results in:
import java.util.UUID;
System.out.println(UUID.randomUUID().toString());
This worked sufficiently for simple cases. However, the complexity is growing and I'd like to start using abstract classes. My simple script only accounts for a single class.
Does a toolkit already exist to help manage the process of parsing the desired sections out of each class and merging them all into a single file?
本文标签: Programmatically composing a BeanShell script from multiple Java class filesStack Overflow
版权声明:本文标题:Programmatically composing a BeanShell script from multiple Java class files - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741931533a2405602.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论