@AllArgsConstructor and @NoArgsConstructor annotations

These two annotations come from lombok, and act on object classes, which can be constructed with parameters or without parameters;
among them, @NoArgsConstructor is a constructor without parameters, which is usually used together with @Data. The specific source code is as follows
Insert @AllArgsConstructor in image description here

package lombok;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({
    
    ElementType.TYPE})
@Retention(RetentionPolicy.SOURCE)
public @interface AllArgsConstructor {
    
    
    String staticName() default "";

    AllArgsConstructor.AnyAnnotation[] onConstructor() default {
    
    };

    AccessLevel access() default AccessLevel.PUBLIC;

    /** @deprecated */
    @Deprecated
    @Retention(RetentionPolicy.SOURCE)
    @Target({
    
    })
    public @interface AnyAnnotation {
    
    
    }
}

insert image description here NoArgsConstructor

package lombok;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({
    
    ElementType.TYPE})
@Retention(RetentionPolicy.SOURCE)
public @interface NoArgsConstructor {
    
    
    String staticName() default "";

    NoArgsConstructor.AnyAnnotation[] onConstructor() default {
    
    };

    AccessLevel access() default AccessLevel.PUBLIC;

    boolean force() default false;

    /** @deprecated */
    @Deprecated
    @Retention(RetentionPolicy.SOURCE)
    @Target({
    
    })
    public @interface AnyAnnotation {
    
    
    }
}

Guess you like

Origin blog.csdn.net/lssffy/article/details/130888656