mardi 10 avril 2018

How can I get generic class of string

I a generic class like this:

public class ProductMsgReqDTO<T extends Serializable> implements Serializable {
private String topic;
private String msgID;
private Date createTime;
private Date receiveTime;
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class")
private T payload;

}

and I get a string of this class through:

method.getGenericParameterTypes()[0].getTypeName()

result is com.xxx.ProductMsgReqDTO<com.xxx.ApolloPayReceiveDTO>,this is a string.

The question is,how can I convert this string result to ProductMsgReqDTO intsance?





Aucun commentaire:

Enregistrer un commentaire