Back to project page PreCTS.
The source code is released under:
Apache License
If you think the Android project PreCTS listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.androidhuman.ctsprepare.data; /*w w w . j av a 2 s .c o m*/ import org.json.simple.JSONObject; import org.json.simple.JSONValue; public class GoogleAccount { public String email; public String password; public static GoogleAccount fromJson(String json){ JSONObject obj = (JSONObject)JSONValue.parse(json); GoogleAccount account = new GoogleAccount(); account.email = (String)obj.get("email"); account.password = (String)obj.get("password"); if(account.email==null || account.password==null){ throw new IllegalStateException("Could not load the account informaion."); } return account; } @SuppressWarnings("unchecked") public String toJson(){ // Check all instance is not null if(this.email==null || this.password==null){ throw new IllegalStateException("Invalid Account information"); } JSONObject obj = new JSONObject(); obj.put("email", this.email); obj.put("password", this.password); return obj.toJSONString(); } }