All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.firebase.ImplFirebaseTrampolines Maven / Gradle / Ivy

Go to download

This is the official Firebase Admin Java SDK. Build extraordinary native JVM apps in minutes with Firebase. The Firebase platform can power your app’s backend, user authentication, static hosting, and more.

There is a newer version: 9.4.1
Show newest version
/*
 * Copyright 2017 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.firebase;

import com.google.api.core.ApiAsyncFunction;
import com.google.api.core.ApiFunction;
import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.cloud.firestore.FirestoreOptions;
import com.google.firebase.internal.FirebaseService;
import com.google.firebase.internal.NonNull;

import java.util.concurrent.Callable;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ThreadFactory;

/**
 * Provides trampolines into package-private APIs used by components of Firebase. Intentionally
 * scarily-named to dissuade people from actually trying to use the class and to make it less likely
 * to appear in code completion.
 *
 * @hide
 */
public final class ImplFirebaseTrampolines {

  private ImplFirebaseTrampolines() {}

  public static GoogleCredentials getCredentials(@NonNull FirebaseApp app) {
    return app.getOptions().getCredentials();
  }

  public static String getProjectId(@NonNull FirebaseApp app) {
    return app.getProjectId();
  }

  public static FirestoreOptions getFirestoreOptions(@NonNull FirebaseApp app) {
    return app.getOptions().getFirestoreOptions();
  }

  public static boolean isDefaultApp(@NonNull FirebaseApp app) {
    return app.isDefaultApp();
  }

  public static  T getService(
      @NonNull FirebaseApp app, @NonNull String id, @NonNull Class type) {
    return type.cast(app.getService(id));
  }

  public static  T addService(
      @NonNull FirebaseApp app, @NonNull T service) {
    app.addService(service);
    return service;
  }

  public static ThreadFactory getThreadFactory(@NonNull FirebaseApp app) {
    return app.getThreadFactory();
  }

  public static  ApiFuture transform(
      ApiFuture input,
      final ApiFunction function,
      @NonNull FirebaseApp app) {
    return ApiFutures.transform(input, function, app.getScheduledExecutorService());
  }

  public static  ApiFuture transformAsync(
      ApiFuture input, final ApiAsyncFunction function, @NonNull FirebaseApp app) {
    return ApiFutures.transformAsync(input, function, app.getScheduledExecutorService());
  }

  public static ScheduledFuture schedule(
      @NonNull FirebaseApp app, @NonNull Runnable runnable, long delayMillis) {
    return app.schedule(runnable, delayMillis);
  }

  public static  ApiFuture submitCallable(
      @NonNull FirebaseApp app, @NonNull Callable command) {
    return app.submit(command);
  }

  public static void startTokenRefresher(@NonNull FirebaseApp app) {
    app.startTokenRefresher();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy