Package lombok
Annotation Type Setter
-
@Target({FIELD,TYPE}) @Retention(SOURCE) public @interface SetterPut on any field to make lombok build a standard setter.Complete documentation is found at the project lombok features page for @Getter and @Setter.
Even though it is not listed, this annotation also has the
onParamandonMethodparameter. See the full documentation for more details.Example:
private @Setter int foo;will generate:public void setFoo(int foo) { this.foo = foo; }This annotation can also be applied to a class, in which case it'll be as if all non-static fields that don't already have a
Setterannotation have the annotation.
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description Setter.AnyAnnotation[]onMethodAny annotations listed here are put on the generated method.Setter.AnyAnnotation[]onParamAny annotations listed here are put on the generated method's parameter.AccessLevelvalueIf you want your setter to be non-public, you can specify an alternate access level here.
-
-
-
Element Detail
-
value
AccessLevel value
If you want your setter to be non-public, you can specify an alternate access level here.- Returns:
- The setter method will be generated with this access modifier.
- Default:
- lombok.AccessLevel.PUBLIC
-
-
-
onMethod
Setter.AnyAnnotation[] onMethod
Any annotations listed here are put on the generated method. The syntax for this feature depends on JDK version (nothing we can do about that; it's to work around javac bugs).
up to JDK7:
@Setter(onMethod=@__({@AnnotationsGoHere}))
from JDK8:
@Setter(onMethod_={@AnnotationsGohere})// note the underscore afteronMethod.- Returns:
- List of annotations to apply to the generated setter method.
- Default:
- {}
-
-
-
onParam
Setter.AnyAnnotation[] onParam
Any annotations listed here are put on the generated method's parameter. The syntax for this feature depends on JDK version (nothing we can do about that; it's to work around javac bugs).
up to JDK7:
@Setter(onParam=@__({@AnnotationsGoHere}))
from JDK8:
@Setter(onParam_={@AnnotationsGohere})// note the underscore afteronParam.- Returns:
- List of annotations to apply to the generated parameter in the setter method.
- Default:
- {}
-
-