Java 类com.intellij.openapi.util.NotNullLazyKey 实例源码

项目:intellij-ce-playground    文件:ServiceManager.java   
/**
 * Creates lazy caching key to store project-level service instance from {@link #getService(Project, Class)}.
 *
 * @param serviceClass Service class to create key for.
 * @param <T>          Service class type.
 * @return Key instance.
 */
public static <T> NotNullLazyKey<T, Project> createLazyKey(@NotNull final Class<T> serviceClass) {
  return NotNullLazyKey.create("Service: " + serviceClass.getName(), new NotNullFunction<Project, T>() {
    @Override
    @NotNull
    public T fun(Project project) {
      return getService(project, serviceClass);
    }
  });
}
项目:tools-idea    文件:ServiceManager.java   
/**
 * Creates lazy caching key to store project-level service instance from {@link #getService(com.intellij.openapi.project.Project, Class)}.
 *
 * @param serviceClass Service class to create key for.
 * @param <T>          Service class type.
 * @return Key instance.
 */
public static <T> NotNullLazyKey<T, Project> createLazyKey(@NotNull final Class<T> serviceClass) {
  return NotNullLazyKey.create("Service: " + serviceClass.getName(), new NotNullFunction<Project, T>() {
    @Override
    @NotNull
    public T fun(Project project) {
      return getService(project, serviceClass);
    }
  });
}
项目:consulo    文件:ServiceManager.java   
/**
 * Creates lazy caching key to store project-level service instance from {@link #getService(Project, Class)}.
 *
 * @param serviceClass Service class to create key for.
 * @param <T>          Service class type.
 * @return Key instance.
 */
public static <T> NotNullLazyKey<T, Project> createLazyKey(@Nonnull final Class<T> serviceClass) {
  return NotNullLazyKey.create("Service: " + serviceClass.getName(), new NotNullFunction<Project, T>() {
    @Override
    @Nonnull
    public T fun(Project project) {
      return getService(project, serviceClass);
    }
  });
}