草庐IT

investmentType

全部标签

java - 如何将 @RestController 中的请求主体转换为抽象值列表?

假设我们有以下类:publicabstractclassInvestment{privateStringinvestmentType;//getters&setters}publicclassEquityextendsInvestment{}publicclassBondextendsInvestment{}publicclassInvestmentFactory{publicstaticInvestmentgetTypeFromString(StringinvestmentType){Investmentinvestment=null;if("Bond".equals(investm