top.cutexingluo.tools.designtools.json.serializer.StrJson Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xingtools-extra Show documentation
Show all versions of xingtools-extra Show documentation
xingtools 依赖core,附加,也就是基于 SpringBoot 的一些工具或实体类
package top.cutexingluo.tools.designtools.json.serializer;
import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.springframework.core.annotation.AliasFor;
import java.lang.annotation.*;
/**
* json序列化器
* 可继承
*
* @author XingTian
* @version 1.0.0
* @date 2024/1/1 14:34
* @since 1.0.4
*/
@Inherited
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@JacksonAnnotationsInside
@JsonSerialize(using = StringJsonSerializer.class)
public @interface StrJson {
/**
* 自定义转化策略
*/
@AliasFor("value")
Class extends StrJsonStrategy> strategy() default DefaultStrJsonStrategy.class;
/**
* 自定义转化策略
*/
@AliasFor("strategy")
Class extends StrJsonStrategy> value() default DefaultStrJsonStrategy.class;
/**
* 策略名称
* 如果为 "" , 则调用strategy 无参构造
* 如果不为 "", 则调用strategy 带一参构造,参数为该name
*/
String name() default "";
/**
* 过滤存在的字段
* true --> 如果为 null 则不执行策略
*/
boolean filterExists() default true;
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy