GsonFactory的杰克逊吊坠?

时间:2015-12-01 10:55:30

标签: android json jackson gson

我使用AuthorizationCodeFlow.Builder(),其中一个参数是new GsonFactory()

由于我已在代码中使用Jackson库,因此我不想再使用Gson。我想用杰克逊解决我的所有问题。

那我怎么能用杰克逊吊坠替换新的GsonFactory()参数呢?

1 个答案:

答案 0 :(得分:0)

com.google.api.client.json.jackson.JacksonFactory

代码段

public void testCredentialCreatedListener() throws IOException {
    MyCredentialCreatedListener listener = new MyCredentialCreatedListener();
    AuthorizationCodeFlow flow =
        new AuthorizationCodeFlow.Builder(BearerToken.queryParameterAccessMethod(),
            new AccessTokenTransport(),
            new JacksonFactory(),
            TOKEN_SERVER_URL,
            new BasicAuthentication(CLIENT_ID, CLIENT_SECRET),
            CLIENT_ID,
            "authorizationServerEncodedUrl").setCredentialCreatedListener(listener).build();
    assertFalse(listener.called);