UpdateInfoBuilder.java
1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.hjx.miaohongentry.builder;
import com.hjx.miaohongentry.bean.AppVersion;
import org.json.JSONException;
import org.json.JSONObject;
/**
* Created by l on 2017/7/8.
*/
public class UpdateInfoBuilder extends JSONBuilder<AppVersion> {
@Override
public AppVersion build(JSONObject jsonObject) throws JSONException {
try {
AppVersion info = new AppVersion();
info.setVersionName(jsonObject.getString(root+"version_name"));
info.setVersionCode(jsonObject.getString(root+"versioncode"));
info.setMsg(jsonObject.getString(root+"msg"));
info.setURL(jsonObject.getString(root+"url"));
String update = jsonObject.getString(root+"forceupdate");
if(update.equalsIgnoreCase("false")){
info.setForceUpdate(false);
}else{
info.setForceUpdate(true);
}
return info;
} catch (JSONException e) {
e.printStackTrace();
return null;
}
}
}