@SuppressWarnings("deprecation")
  private Credential newCredential(String userId) {
    Credential.Builder builder = new Credential.Builder(method).setTransport(transport)
        .setJsonFactory(jsonFactory)
        .setTokenServerEncodedUrl(tokenServerEncodedUrl)
        .setClientAuthentication(clientAuthentication)
        .setRequestInitializer(requestInitializer)
        .setClock(clock);
    if (credentialDataStore != null) {
      builder.addRefreshListener(
          new DataStoreCredentialRefreshListener(userId, credentialDataStore));
    } else if (credentialStore != null) {
      builder.addRefreshListener(new CredentialStoreRefreshListener(userId, credentialStore));
    }
    builder.getRefreshListeners().addAll(refreshListeners);
    return builder.build();
  }
@ SuppressWarnings ( "deprecation" ) private Credential newCredential ( String userId ) { Credential . Builder builder = new Credential . Builder ( method ) . setTransport ( transport ) . setJsonFactory ( jsonFactory ) . setTokenServerEncodedUrl ( tokenServerEncodedUrl ) . setClientAuthentication ( clientAuthentication ) . setRequestInitializer ( requestInitializer ) . setClock ( clock ) ; if ( credentialDataStore != null ) { builder . addRefreshListener ( new DataStoreCredentialRefreshListener ( userId , credentialDataStore ) ) ; } else if ( credentialStore != null ) { builder . addRefreshListener ( new CredentialStoreRefreshListener ( userId , credentialStore ) ) ; } builder . getRefreshListeners ( ) . addAll ( refreshListeners ) ; return builder . build ( ) ; }
Returns a new credential instance based on the given user ID.

@param userId user ID or {@code null} if not using a persisted credential store