Java Code Examples for com.intellij.openapi.util.NotNullLazyKey

The following are top voted examples for showing how to use com.intellij.openapi.util.NotNullLazyKey. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: intellij-ce-playground   File: ServiceManager.java   View source code 5 votes vote down vote up
/**
 * 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);
    }
  });
}
 
Example 2
Project: tools-idea   File: ServiceManager.java   View source code 5 votes vote down vote up
/**
 * 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);
    }
  });
}
 
Example 3
Project: consulo   File: ServiceManager.java   View source code 5 votes vote down vote up
/**
 * 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);
    }
  });
}