如何在Java中将提到的Java对象转换为列表对象 Java对象内部具有一个列表,其中包含相同类型的对象

问题描述

我的Pojo通话:

package com.ecosys.smartbuild.bean;

import java.util.Arrays;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
    
public class ProgressAndDatesstructure {

private String id;

private String startDate;

private String endDate;

private String progress;

private ProgressAndDatesstructure progressandDatesstructure[];

/**
 * @return the id
 */
public String getId() {
    return id;
}

/**
 * @param id the id to set
 */
public void setId(String id) {
    this.id = id;
}

/**
 * @return the startDate
 */
public String getStartDate() {
    return startDate;
}

/**
 * @param startDate the startDate to set
 */
public void setStartDate(String startDate) {
    this.startDate = startDate;
}

/**
 * @return the endDate
 */
public String getEndDate() {
    return endDate;
}

/**
 * @param endDate the endDate to set
 */
public void setEndDate(String endDate) {
    this.endDate = endDate;
}

/**
 * @return the progress
 */
public String getProgress() {
    return progress;
}

/**
 * @param progress the progress to set
 */
public void setProgress(String progress) {
    this.progress = progress;
}

/**
 * @return the progressandDatesstructure
 */
public ProgressAndDatesstructure[] getProgressandDatesstructure() {
    return progressandDatesstructure;
}

/**
 * @param progressandDatesstructure the progressandDatesstructure to set
 */
public void setProgressandDatesstructure(ProgressAndDatesstructure[] progressandDatesstructure) {
 this.progressandDatesstructure = progressandDatesstructure;
}

我的对象

ProgressAndDatesstructure [id=PRJ-0000001,startDate=null,endDate=null,progress=null,progressandDatesstructure=[ProgressAndDatesstructure [id=PRJ-0000001.1,startDate=2019-05-16T02:30:00.000Z,endDate=2019-09-18T11:30:00.000Z,progress=50.00,progressandDatesstructure=[ProgressAndDatesstructure [id=PRJ-0000001.1.1,endDate=2019-08-18T11:30:00.000Z,progressandDatesstructure=null],ProgressAndDatesstructure [id=PRJ-0000001.1.2,startDate=2019-07-16T02:30:00.000Z,progressandDatesstructure=null]]],ProgressAndDatesstructure [id=PRJ-0000001.2,startDate=2019-03-16T02:30:00.000Z,progress=25.00,progressandDatesstructure=[ProgressAndDatesstructure [id=PRJ-0000001.2.1,startDate=2019-04-16T02:30:00.000Z,ProgressAndDatesstructure [id=PRJ-0000001.2.2,endDate=2019-07-18T11:30:00.000Z,ProgressAndDatesstructure [id=PRJ-0000001.3,progress=70.00,progressandDatesstructure=[ProgressAndDatesstructure [id=PRJ-0000001.3,progressandDatesstructure=null]]]]]

我需要progressandDatesstructure对象的列表。它可以具有任意数量的内部progressandDatesstructure对象,但是我需要简单的对象列表,其中仅包含idstartdateenddateprogress。 / p>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)