title: Optional in Lombok
body: <p>I have a class called <code>Address</code> which looks like this:</p>
  
  <pre><code>@Value
  class Address {
  
     @NotNull String userId;
     @NotNull String line1;
     String line2;
  
     private Address(Builder b) {
        // copy everything from builder
     }
  
     // override getter for line2 so that it returns Optional&lt;String&gt;
     public Optional&lt;String&gt; getLine2() {
        return Optional.ofNullable(this.line2);
     }
  
     // and a Builder
     public static class Builder {
       // builder methods
     }
  }
  </code></pre>
  
  <p>Here I am forced to write <code>Builder</code> and a <code>Getter</code> because, if I want to return an Optional while using Lombok, I will have to declare <code>line2</code> as <code>Optional&lt;String&gt;</code>. And that will generate a builder method which accepts <code>Optional&lt;String&gt;</code>!</p>
  
  <p>Is there any other way to use lombok with <code>Optional</code>?</p>