0

以下のコードは、Web サービスの応答形式です。このクラスには、2 つの内部静的クラスへの 2 つの参照変数があります。効率よく読む方法を教えてください。

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

読みたいinstanceofを取得し、その中のofを呼び出してofを取得し、その内部クラスで(再び)を呼び出します。効率的なようです。Recordpublic variableclassinstancevariablepublicvariables

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