使用Java8解析嵌套java类(POJO)以调用方法并获得返回的结果
我试图解析嵌套类(POJO)并调用一个函数,该函数使用Java8返回一个双数组。 类结构如下所示(该结构用于保存json输入-工作正常)使用Java8解析嵌套java类(POJO)以调用方法并获得返回的结果,java,spring-boot,parsing,java-8,Java,Spring Boot,Parsing,Java 8,我试图解析嵌套类(POJO)并调用一个函数,该函数使用Java8返回一个双数组。 类结构如下所示(该结构用于保存json输入-工作正常) 向我们展示您的尝试?对于(借款人:借款人){List facilities=Borrower.getfacilities();对于(贷款:facilities){listReturnmentScheduleList=Facility.getReturnmentScheduleList();如果(ReturnmentScheduleList!=null){for
向我们展示您的尝试?对于(借款人:借款人){List facilities=Borrower.getfacilities();对于(贷款:facilities){listReturnmentScheduleList=Facility.getReturnmentScheduleList();如果(ReturnmentScheduleList!=null){for(ReturnmentScheduleList还款计划表:ReturnmentScheduleList){double[]摊销配置文件=摊销服务.计算摊销计划(还款计划);System.out.println(“摊销配置文件:”+摊销配置文件);}}}以上方法可行,但我想知道使用函数式编程的最有效方法。不要在评论中发布程序代码,你的问题,并添加所有必要的细节。
creditcomplex {
field 1;
field 2;
List<Borrower>;}
Borrower {
field 1;
field 2;
List<Facility>;}
Facility {
field 1;
field 2;
List<PaymentSchedule>;}
for (Borrower borrower : borrowers) {
List<Facility> facilities = borrower.getFaciliies();
for (Facility facility : facilities) {
List<RepaymentSchedule>repaymentScheduleList = facility.getrepaymentSchedule();
if (repaymentScheduleList != null ){
for(RepaymentSchedule repaymentschedule : repaymentScheduleList){
double[] amortizationProfile = amortizationService.calculateAmortizationSchedule(repaymentschedule);
System.out.println("amortizationProfile : " + amortizationProfile);
}
}
}
}