我使用的是JBoss Developer Studio 8.1.0.GA,我有一个特定类型的类,该类具有静态聚集器之类的用于配置对象的方法。
虽然我希望以常规方式包装任何其他类型的方法(在格式化程序中在必要时进行包装),但我希望使用关键字包装此类对象,所以我在想也许可以采用一种基于正则表达式的规则的方法?
Obj obj1 = new Obj();
Obj obj2 = new Obj();
Obj obj3 = new Obj();
Obj obj4 = new Obj();
// Wrap would be the starting point for configuring this objects
// It structures some objects in a tree-like structure with different heights
// which I'd like to reflect with indentation
wrap(1, obj1).with().config().stuff()
.wrap(2, obj2).with().other().things() // obj1 child
.wrap(2, obj3).with().whatever() // obj2 sibling
.wrap(3, obj4).last().config(); // obj4 is obj3 child
虽然我意识到这根本不像Java,但这是项目所需要的,并且能够缩进像这样的代码将非常有帮助。
我试图使其与Checkstyle一起使用,但是它已经过时了,即使在使用默认规则查看我是否犯了某种错误时,运行构建也会中断。
如果可以使它们正常工作,我很愿意插入插件。