Closed nexen505 closed 5 years ago
Generic exists only at the stage of writing code. There is no information about him in runtime.
I use the following code to solve the problem.
export UserPagedList extends PagedList<User>{
@jsonProperty([Use])
public elements: User[] = [];
}
export abstract class PagedList<TEntity> extends Serializable {
public abstract elements: TEntity[] = [];
@jsonProperty(Number)
public pageNumber: number = 0;
...
@jsonProperty(Number)
public totalElements: number = 0;
}
But if you offer a more beautiful version, I will implement it.
How to handle generic classes?
For example, I have class
How to handle this?