Search in sources :

Example 1 with UserJson

use of cn.eoe.app.entity.UserJson in project android-app by eoecn.

the class UserDao method mapperJson.

public UserResponse mapperJson(String key) {
    // TODO Auto-generated method stub
    UserJson userJson;
    try {
        if (!key.contains(":")) {
            return null;
        }
        String url = String.format(Urls.KEYBindURL, key) + Utility.getParams(key);
        String result = HttpUtils.getByHttpClient(mContext, url);
        userJson = mObjectMapper.readValue(result, new TypeReference<UserJson>() {
        });
        if (userJson == null) {
            return null;
        }
        return userJson.getResponse();
    } catch (JsonParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (JsonMappingException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
Also used : UserJson(cn.eoe.app.entity.UserJson) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) TypeReference(org.codehaus.jackson.type.TypeReference) IOException(java.io.IOException) JsonParseException(org.codehaus.jackson.JsonParseException) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) JsonParseException(org.codehaus.jackson.JsonParseException) IOException(java.io.IOException)

Aggregations

UserJson (cn.eoe.app.entity.UserJson)1 IOException (java.io.IOException)1 JsonParseException (org.codehaus.jackson.JsonParseException)1 JsonMappingException (org.codehaus.jackson.map.JsonMappingException)1 TypeReference (org.codehaus.jackson.type.TypeReference)1