Advertisement
Guest User

Untitled

a guest
Apr 21st, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. public void setAccess (ArrayList<RestAccess> rr) {
  2. restaccess = rr;
  3. }
  4.  
  5.  
  6. public ArrayList<RestAccess> getAccess () {
  7. return restaccess;
  8. }
  9.  
  10. public void setExpDate (String expdate){
  11. this.expiration_date = expdate;
  12. }
  13.  
  14.  
  15. public String getExpDate() {
  16. return this.expiration_date;
  17. };
  18.  
  19. public static void main(String[] args) throws FileNotFoundException, IOException {
  20. // TODO code application logic here
  21. String fpath = "C:\BPMINST\json.txt";
  22.  
  23. String json_str = "";
  24. BufferedReader bufferedReader = null;
  25. bufferedReader = new BufferedReader(new FileReader(fpath));
  26. String sCurrentLine;
  27. while ((sCurrentLine = bufferedReader.readLine()) != null) {
  28. json_str = json_str + sCurrentLine;
  29. }
  30. System.out.println(json_str);
  31. Gson gson = new Gson();
  32. CollectionAccess orderHeader = gson.fromJson(json_str, CollectionAccess.class);
  33. if (orderHeader==null){
  34. System.out.println("orderHeader is null");
  35. return;
  36. } else {
  37. System.out.println("orderHeader not is null");
  38. };
  39. ArrayList<RestAccess> orderDetailList = orderHeader.getAccess();
  40. if (orderDetailList!=null){
  41. System.out.println(orderDetailList.size());
  42. };
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement