Annotation Type Builder.Factory


  • @Documented
    @Target(METHOD)
    public static @interface Builder.Factory
    Annotate static factory methods that produce some value (non-void, non-private) to create builder out of constructor parameters.
     class Sum {
       @Builder.Factory
       static Integer sum(int a, int b) {
          return a + b;
       }
     }
     ... // use generated builder
     Integer result = new SumBuilder()
        .a(111)
        .b(222)
        .build();
     

    Class level and package level style annotations fully supported (see Value.Style).