如何从 IntelliJ 中的接口生成 java bean 类?
因此,已经有一种方法可以在 IntelliJ (v11) 中生成类的实现,但它相当简单。
它将创建一个具有满足接口所需的所有方法的类。这些方法是空的,并在适当的情况下返回 null。
我正在寻找的是一个插件或者可以从接口生成 bean 的东西。如果生成器在接口中看到方法 getXXXX 或 setXXX(或 isXXX),它将创建该类型的成员,并分别在实现的类中获取或返回该成员。
So, there already is a way to generate an implementation of a class in IntelliJ (v11), but it is rather simple.
It will create a class with all the methods necessary to satisfy the interface. These methods are empty and return null where appropriate.
What I am looking for is a plugin or something that will generate beans from a interface. If the generator sees a method getXXXX or setXXX (or isXXX) in the interface, it will create a member of that type and get or return that member, respectively in the implemented class.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您所能做的就是创建一个实现该接口的新类,然后告诉 IntelliJ 实现所有方法。从那时起,您就可以填写方法的核心内容了。据我所知,没有什么魔法。
All you can do is create a new class that implements the interface, then tell IntelliJ to implement all the methods. From that point, it's up to you to fill in the meat of the methods. There's no magic that I know of.