Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void setAccess (ArrayList<RestAccess> rr) {
- restaccess = rr;
- }
- public ArrayList<RestAccess> getAccess () {
- return restaccess;
- }
- public void setExpDate (String expdate){
- this.expiration_date = expdate;
- }
- public String getExpDate() {
- return this.expiration_date;
- };
- public static void main(String[] args) throws FileNotFoundException, IOException {
- // TODO code application logic here
- String fpath = "C:\BPMINST\json.txt";
- String json_str = "";
- BufferedReader bufferedReader = null;
- bufferedReader = new BufferedReader(new FileReader(fpath));
- String sCurrentLine;
- while ((sCurrentLine = bufferedReader.readLine()) != null) {
- json_str = json_str + sCurrentLine;
- }
- System.out.println(json_str);
- Gson gson = new Gson();
- CollectionAccess orderHeader = gson.fromJson(json_str, CollectionAccess.class);
- if (orderHeader==null){
- System.out.println("orderHeader is null");
- return;
- } else {
- System.out.println("orderHeader not is null");
- };
- ArrayList<RestAccess> orderDetailList = orderHeader.getAccess();
- if (orderDetailList!=null){
- System.out.println(orderDetailList.size());
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement