Search code examples
jsongwtautobean

AutoBeanFactory map Json property names


I am currently checking out a decent way for (de)-serializing objects within GWT. Seems all nice and dandy, but I cannot find an answer to the following problem:

Given I have in interface such as:

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);
}

which aligns with Javas naming convention for Beans. Now when I receive a Json String like:

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

How does mapping from "access_token" to 'accessToken' work?


Solution

  • Ok, a slightly deeper websearch sometimes helps! For anyone else asking the same question, here it goes:

    @AutoBean.PropertyName("name")