@ 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 .