关于java:打印子类时显示父类属性及仅显示非空字段

57次阅读

共计 582 个字符,预计需要花费 2 分钟才能阅读完成。

Java 继承 打印子类时显示父类属性

@ToString(callSuper = true)

java 去掉返回对象中为 NULL 的属性~~~~

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.7.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.7.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.7.3</version>
</dependency>~~~~

属性加注解

@JsonInclude(JsonInclude.Include.NON_NULL)
private String upSystemId;

来自
Java 继承 打印子类时显示父类属性
java 去掉返回对象中为 NULL 的属性

正文完
 0