首頁  >  問答  >  主體

java - 一個多層嵌套的類,json的輔助類需要初始化,要怎麼寫比較簡單?

public class PieOption {
 private SeriesBean series;
    public static class SeriesBean {
        private LabelBean label;
        public static class LabelBean {      
            private EmphasisBean emphasis;
            public static class EmphasisBean {
                private boolean show;
                private TextStyleBean textStyle;
                public static class TextStyleBean {
                    private String fontSize;
                    private String fontWeight;
                }
            }
        }
    }
}

new個物件再來呼叫set方法實在是太費事了
SeriesBean.LabelBean.EmphasisBean.TextStyleBean textStyleBean = new SeriesBean.LabelBean.EmphasisBean.TextStyleBean();就這樣寫太可怕了

############################################################# ##
阿神阿神2712 天前494

全部回覆(1)我來回復

  • 滿天的星座

    滿天的星座2017-05-17 10:09:49

    不要寫成內部類別...

    回覆
    0
  • 取消回覆