I have a java POJO with values set. i set values like the following :
CreateRequisitionRO[] request = new CreateRequisitionRO[1];
request[0].setPortfolio("HEXGENFUND");
request[0].setTransSrlNo(new BigDecimal(1));
request[0].setTransCode("BUY");
request[0].setInvestReason("009");
request[0].setInflowOutflow(InflowOutflow.I);
request[0].setTradeDate(new LocalDate());
request[0].setTradeDate(new LocalDate());
and this is my json serialize method :
public String serialiseRequisionRO(CreateRequisitionRO[] requestObj) {
//CreateRequisitionRO requestObj = new CreateRequisitionRO();
JSONSerializer serializer = new JSONSerializer();
System.out.println("JSON : "+serializer.serialize(requestObj));
return serializer.serialize(requestObj);
}
but when i excute the program i get Null Pointer exception at this line request[0].setPortfolio("HEXGENFUND");
how to resolve it. and what could be the solution.
Please help me to resolve this.
Best Regards Anto
您需要初始化数组元素。
request[0] = new CreateRequisitionRO();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.