0

下面的代码是一个 Web 服务响应格式。这个类有两个引用变量到两个内部静态类。请让我知道如何以有效的方式阅读。

public class DataResponse {
      protected DataResponse.Head head ;
      protected DataResponse.Result result ;

      public static class Result {
         protected List<DataResponse.Result.Record> record;

          public static class Record {
             protected String businesstypec;
             protected String part
             // several other variables

                 public static class PARTR {
                       protected String prefix;
                       protected String suffix;
                 }
          }

         public static class Head {

          // some more variables
         }

      // please assume getter and setters for head,result,record,prefix and suffix variables
}
4

1 回答 1

2

你得到你想要阅读的 of 并调用instanceinside来得到那个,然后在那个内部类中调用(再次,)。看起来很有效率。Recordpublic variableclassinstancevariablepublicvariables

 String firstPrefix = result.record.get(0).partrVariableThatsNotInYourExample.prefix;
于 2012-05-03T18:13:31.630 回答