【问题标题】:AutoBeanFactory map Json property namesAutoBeanFactory 映射 Json 属性名称
【发布时间】:2016-03-23 14:53:11
【问题描述】:

我目前正在检查一种在 GWT 中(反)序列化对象的体面方法。看起来一切都很好,但我找不到以下问题的答案:

鉴于我有这样的界面:

public interface OAuth {

    String getAccessToken();

    void setAccessToken(String accessToken);

    String getRefreshToken();

    void setRefreshToken(String refreshToken);

    String getTokenType();

    void setTokenType(String tokenType);

    String getScope();

    void setScope(String scope);

    int getExpiresIn();

    void setExpiresIn(int expiresIn);
}

这与 Bean 的 Java 命名约定一致。现在,当我收到一个 Json 字符串时:

{
    "access_token": "",
    "token_type": "",
    "refresh_token": "",
    "expires_in": 0,
    "scope": ""
}

从“access_token”到“accessToken”的映射如何工作?

【问题讨论】:

    标签: json gwt autobean


    【解决方案1】:

    好的,稍微深入的网络搜索有时会有所帮助! 对于其他提出相同问题的人,这里是:

    @AutoBean.PropertyName("name")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-06
      • 2016-03-17
      • 1970-01-01
      • 2015-06-09
      • 1970-01-01
      • 2019-04-18
      • 1970-01-01
      • 2013-01-10
      相关资源
      最近更新 更多