I was asked to edit a java file so that it would retrieve a value. The value name is not important, but it was SiteCategory.
With the help of Eclipse I was able to find the method that looked like what I was looking for.
I then created these seven lines to see if one of them returned what I was looking for.
System.out.println("1) " + p_objRecord.getSiteCategoryList().toString());
System.out.println("2) " + p_objRecord.getSiteCategoryList().getClass());
System.out.println("3) " + p_objRecord.getSiteCategoryList().getSiteCategory().toString());
System.out.println("4) " + p_objRecord.getSiteCategoryList().getSiteCategory(0).getCategoryDescription());
System.out.println("5) " + p_objRecord.getSiteCategoryList().getSiteCategory(0).toString());
System.out.println("6) " + p_objRecord.getSiteCategoryList().getSiteCategory(0).getCategory().getName());
System.out.println("7) " + p_objRecord.getSiteCategoryList().getSiteCategory(0).getCategory().toString());
This was the output
1) com.webservices.lists.farming.SiteCategoryList@47c7b1f5
2) class com.webservices.lists.farming.SiteCategoryList
3) [Lcom.webservices.lists.farming.SiteCategory;@105e924
4) >P align=left>
5) com.webservices.lists.farming.SiteCategory@ca143fc6
6) Products : Miscellaneous : Bottles
7) com.webservices.platform.core.RecordRef@78f8dcf1
Number 6 was exactly what I was looking for. It took me some time to finally get to this point and figure out the correct syntax. If you were asked to do this with an unfamiliar API, what would you have done to figure out the correct syntax?