-
Notifications
You must be signed in to change notification settings - Fork 497
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
core/src/test/java/com/alibaba/fastjson2/issues_2100/Issue2153.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.alibaba.fastjson2.issues_2100; | ||
|
||
import com.alibaba.fastjson2.JSON; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.Serializable; | ||
import java.util.Date; | ||
|
||
public class Issue2153 { | ||
@Test | ||
public void test() { | ||
String str = "{\"addTime\":1703124696338,\"updateTime\":1703124696338,\"id\":7}"; | ||
User user = JSON.parseObject(str, User.class); | ||
System.out.println(user.toString()); | ||
} | ||
|
||
public interface ID extends Serializable { | ||
Serializable getId(); | ||
} | ||
|
||
public interface Bean<K extends Serializable> extends ID { | ||
@Override | ||
K getId(); | ||
|
||
void setId(K id); | ||
} | ||
|
||
@Getter | ||
@Setter | ||
public static abstract class BaseEntity implements Bean<Long> { | ||
Long id; | ||
} | ||
|
||
@Getter | ||
@Setter | ||
public static abstract class TimeBaseEntity extends BaseEntity { | ||
Date addTime; | ||
Date updateTime; | ||
} | ||
|
||
@Getter | ||
@Setter | ||
public static class User extends BaseEntity { | ||
String addr; | ||
Long a, b, c, d, e, f, g; | ||
} | ||
} |