dromara / easy-query

java/kotlin high performance lightweight solution for jdbc query,support oltp and olap query,一款java下面支持强类型、轻量级、高性能的ORM,致力于解决jdbc查询,拥有对象模型筛选、隐式子查询、隐式join
http://www.easy-query.com
Apache License 2.0
477 stars 48 forks source link

建议 @Nullable @NotNull 注解支持 JSR-305 规范 #222

Open bengbengbalabalabeng opened 1 month ago

bengbengbalabalabeng commented 1 month ago

模块:sql-core 涉及代码:@Nullable@NotNull 建议:支持 JSR-305 规范,这样可以让标记了以上注解的 API 在常用的 IDE 上有更好的可读性(如:idea 中对代码加重灰色提示可能出现的潜在问题)提升代码的健壮性。

package com.easy.query.core.annotation;

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

// jsr-305 support
import javax.annotation.Nonnull;
import javax.annotation.meta.TypeQualifierNickname;
import javax.annotation.meta.When;
// jsr-305 support

/**
 * create time 2023/11/26 07:32
 * 文件说明
 *
 * @author xuejiaming
 */
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE})
// jsr-305 support
@Nonnull(when=MAYBE)
@TypeQualifierNickname
// jsr-305 support
public @interface Nullable {
    String value() default "";
}
package com.easy.query.core.annotation;

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

// jsr-305 support
import javax.annotation.Nonnull;
import javax.annotation.meta.TypeQualifierNickname;
// jsr-305 support

/**
 * create time 2023/11/26 07:32
 * 文件说明
 *
 * @author xuejiaming
 */
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE})
// jsr-305 support
@Nonnull
@TypeQualifierNickname
// jsr-305 support
public @interface NotNull {
    String value() default "";
}
xuejmnet commented 1 month ago

@bengbengbalabalabeng 非常棒的建议后续会逐步增加