简体   繁体   中英

Lombok documentation and interface in Java

Normally in Lombok the documentation that shows up in getters and setters are inherited from the field. 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. 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?

Disclosure: I am a lombok developer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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