0

The below code is a web service response format.This class has two reference variables to two inner static class. Please let me know how to read in an efficiant way.

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
}
Angelo Fuchs
  • 9,825
  • 1
  • 35
  • 72
aditya86c
  • 57
  • 2
  • 12

1 Answers1

2

You get the instance of Record you want to read and call the public variable of the class within to get the instance of that variable and then call the (again, public) variables in that inner class. Seems efficient.

 String firstPrefix = result.record.get(0).partrVariableThatsNotInYourExample.prefix;
Angelo Fuchs
  • 9,825
  • 1
  • 35
  • 72