前言
今天在看GitHub某大神写的代码的时候看到一个标签并没有使用过,所有百度了一下使用方法在此记录一下。
@Accessors
Accessor的中文含义是存取器,@Accessors用于配置getter和setter方法的生成结果。
源代码:
@Target({ElementType.TYPE, ElementType.FIELD})
@Retention(RetentionPolicy.SOURCE)
public @interface Accessors {
/**
* If true, accessors will be named after the field and not include a {@code get} or {@code set}
* prefix. If true and {@code chain} is omitted, {@code chain} defaults to {@code true}.
* default: false
*
* @return Whether or not to make fluent methods (named {@code fieldName()}, not for example {@code setFieldName}).
*/
boolean fluent() default false;
/**
* If true, setters return {@code this} instead of {@code void}.
* default: false,