예제 #1
0
    public User(JSONValue user) throws NoSuchJSONValueException {
      if (user.isObject() == null) {
        throw new NoSuchJSONValueException();
      }

      id = JSONUtil.getLong(user, "id");
      href = JSONUtil.getString(user, "href");
      domain = JSONUtil.getString(user, "domain");
      firstName = JSONUtil.getString(user, "first_name");
      lastName = JSONUtil.getString(user, "last_name");
      nickName = JSONUtil.getString(user, "nickname");
    }
예제 #2
0
  public Session(JSONValue session) throws NoSuchJSONValueException {

    if (session.isObject() == null) {
      throw new NoSuchJSONValueException();
    }

    mid = JSONUtil.getLong(session, "mid");
    sid = JSONUtil.getString(session, "sid");
    secret = JSONUtil.getString(session, "sid");
    expire = JSONUtil.getLong(session, "expire");
    sig = JSONUtil.getString(session, "sig");

    if (session.isObject().containsKey("user")) {
      user = new User(JSONUtil.getValue(session, "user"));
    } else {
      user = null;
    }
  }