@Target(value={FIELD,TYPE}) @Retention(value=SOURCE) public @interface Getter
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 onMethod
parameter. See the full documentation for more details.
Example:
private @Getter int foo;will generate:
public int getFoo() { return this.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 @Getter
annotation have the annotation.
Modifier and Type | Optional Element and Description |
---|---|
boolean |
lazy |
Getter.AnyAnnotation[] |
onMethod
Any annotations listed here are put on the generated method.
|
AccessLevel |
value
If you want your getter to be non-public, you can specify an alternate access level here.
|
public abstract AccessLevel value
public abstract Getter.AnyAnnotation[] onMethod
@Getter(onMethod=@__({@AnnotationsGoHere}))
@Getter(onMethod_={@AnnotationsGohere})
// note the underscore after onMethod
.Copyright © 2024. All rights reserved.