All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
gu.sql2java.wherehelper.annotations.IfElse Maven / Gradle / Ivy
package gu.sql2java.wherehelper.annotations;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import gu.sql2java.wherehelper.CompareOp;
import gu.sql2java.wherehelper.VarTestType;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
/**
* WhereHelper if ... else ... 条件表达式注解,
* 当{@link #test()},{@link #testNullVars()},{@link #testNonullVars()},{@link #testEmptyVars()},
* {@link #testNoEmptyVars()},{@link #testTrueVars() },{@link #testFalseVars()} 都为空时忽略
* @author guyadong
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD,ElementType.TYPE})
@Documented
@Repeatable(IfElses.class)
public @interface IfElse {
/**
* BeanShell 条件判断表达式,表达执行为{@code true}时,执行{@link #doStatement()}定义的语句,否则执行{@link #elseStatement()}定义的语句
*/
String test() default " true ";
/**
* 要求为null的变量名列表,['var1','var2'],等价于'null==${var1} && null==${var2}',为空则默认为'true'
* @since 3.25.0
*/
String[] testNullVars() default{};
/**
* 要求不为null的变量名列表,['var1','var2'],等价于'null!=${var1} && null!=${var2}',为空则默认为'true'
* @since 3.25.0
*/
String[] testNonullVars() default{};
/**
* 要求为{@code null}或空的变量名列表,['var1','var2'],等价于'isEmpty(${var1}) && isEmpty(${var2})',为空则默认为'true'
* @since 3.25.0
*/
String[] testEmptyVars() default{};
/**
* 要求不为{@code null}或空的变量名列表,['var1','var2'],等价于!'isEmpty(${var1}) && !isEmpty(${var2})',为空则默认为'true'
* @since 3.25.0
*/
String[] testNoEmptyVars() default{};
/**
* 要求为{@code true}的变量名列表,['var1','var2'],等价于'isTrue(${var1)} && isTrue(${var2})',为空则默认为'true'
* @since 3.25.0
*/
String[] testTrueVars() default{};
/**
* 要求为{@code false}的变量名列表,['var1','var2'],等价于'isFalse(${var1}) && isFalse(${var2})',为空则默认为'true'
* @since 3.25.0
*/
String[] testFalseVars() default{};
/**
* 定义基于{@link #testType()}的条件测试表达式变量名
* @since 3.25.0
*/
String testVar() default "";
/**
* 变量测试类型
* @since 3.25.0
*/
VarTestType testType() default VarTestType.EQUAL;
/**
* 条件测试操作符
* @since 3.25.0
*/
CompareOp testOp() default CompareOp.EQ ;
/**
* 变量条件测试的目标值
* @since 3.25.0
*/
String testValue() default "";
/**
* 为{@code true}生成表达式对{@link #testValue()} 以字符串对头尾增加单引号,
* {@link #testRefValue()}为{@code true}时忽略
* @since 3.25.0
*/
boolean testQuote() default false;
/**
* 为{@code true}生成表达式对{@link #testValue()} 视为变量名
* @since 3.25.0
*/
boolean testRefValue() default false;
/**
* 条件测试表达式,为true时创建表达式
*/
String doStatement() default "";
/**
* test表达式执行为false时执行的表达式
*/
String elseStatement() default "";
}