简体   繁体   English

Java中的Lombok文档和接口

[英]Lombok documentation and interface in Java

Normally in Lombok the documentation that shows up in getters and setters are inherited from the field. 通常在Lombok中,在getter和setter中显示的文档是从该字段继承的。 But I have a class that needs to have an interface. 但是我有一个需要接口的类。 In Java interfaces do not have fields and so I must define the fields in the concrete class. 在Java接口中没有字段,因此我必须在具体类中定义字段。 How do I make sure I do not duplicate documentation but still have the documentation associated with the field? 如何确保我没有重复的文档,但仍具有与该字段关联的文档?

In code 在代码中

@Data
public class MyClass implements MyInterface{
    /**
    *My doc
    */
    final private List<String> myField;
}

public interface MyInterface{
    public List<String> getMyField();
}

Did you try to add {@inheritDoc} to the javadoc on the field in the -- GETTER -- section as described in the documentation and have the javadoc for getMyField only in the interface? 您是否按照文档的说明尝试将{@inheritDoc}添加到-- GETTER --部分中的字段上的javadoc中, getMyField仅在接口中具有getMyField的javadoc?

Disclosure: I am a lombok developer. 披露:我是lombok开发人员。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM