Package lombok

Annotation Type Builder.ObtainVia


@Target({FIELD,PARAMETER})
@Retention(SOURCE)
public static @interface Builder.ObtainVia
Put on a field (in case of @Builder on a type) or a parameter (for @Builder on a constructor or static method) to indicate how lombok should obtain a value for this field or parameter given an instance; this is only relevant if toBuilder is true. You do not need to supply an @ObtainVia annotation unless you wish to change the default behaviour: Use a field with the same name.

Note that one of field or method should be set, or an error is generated.

The default behaviour is to obtain a value by referencing the name of the parameter as a field on 'this'.

  • Optional Element Summary

    Optional Elements 
    Modifier and Type Optional Element Description
    java.lang.String field  
    boolean isStatic  
    java.lang.String method  
  • Element Details

    • field

      java.lang.String field
      Returns:
      Tells lombok to obtain a value with the expression this.value.
      Default:
      ""
    • method

      java.lang.String method
      Returns:
      Tells lombok to obtain a value with the expression this.method().
      Default:
      ""
    • isStatic

      boolean isStatic
      Returns:
      Tells lombok to obtain a value with the expression SelfType.method(this); requires method to be set.
      Default:
      false