Annotation Type Builder.Parameter


  • @Documented
    @Target({PARAMETER,METHOD})
    public static @interface Builder.Parameter
    Factory method parameter might be turned into builder parameter using this annotation.
     class NodeFactory {
       @Builder.Factory
       static Node node(@Builder.Parameter Object value, Optional<Node> left, Optional<Node> right) {
          return ...
       }
     }
     ... // notice the constructor parameter generated
     Integer result = new NodeBuilder(new Object())
        .left(node1)
        .right(node2)
        .build();
     

    Also note that with some limitation this annotation works on value type attribute to generate builder parameter.