Home  >  Q&A  >  body text

java - A multi-layer nested class. The json auxiliary class needs to be initialized. How to write it more easily?

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;
                }
            }
        }
    }
}

It is too troublesome to call the set method for a new object
SeriesBean.LabelBean.EmphasisBean.TextStyleBean textStyleBean = new SeriesBean.LabelBean.EmphasisBean.TextStyleBean();It’s too scary to write like this

阿神阿神2712 days ago495

reply all(1)I'll reply

  • 滿天的星座

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

    Don’t write it as an inner class...

    reply
    0
  • Cancelreply