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

com.google.inject.multibindings.MultibindingsScanner Maven / Gradle / Ivy

package com.google.inject.multibindings;

import com.google.common.collect.ImmutableSet;
import com.google.inject.Binder;
import com.google.inject.Key;
import com.google.inject.Module;
import com.google.inject.spi.InjectionPoint;
import com.google.inject.spi.ModuleAnnotatedMethodScanner;
import com.google.inject.util.Modules;
import java.lang.annotation.Annotation;
import java.util.Set;

/**
 * Scans a module for annotations that signal multibindings, mapbindings, and optional bindings.
 *
 * @since 4.0
 * @deprecated This functionality is installed by default. All references to this can be safely
 *     removed. This class will be removed in Guice 4.4
 */
@Deprecated
public class MultibindingsScanner {
  private MultibindingsScanner() {}

  /**
   * Returns a module that, when installed, will scan all modules for methods with the annotations
   * {@literal @}{@link ProvidesIntoMap}, {@literal @}{@link ProvidesIntoSet}, and
   * {@literal @}{@link ProvidesIntoOptional}.
   *
   * 

This is a convenience method, equivalent to doing {@code * binder().scanModulesForAnnotatedMethods(MultibindingsScanner.scanner())}. * * @deprecated This functionality is now installed by default. All references/installations can be * eliminated. */ @Deprecated public static Module asModule() { return Modules.EMPTY_MODULE; } /** * @deprecated This method returns an empty scanner since the preexisting functionality is * installed by default. */ @Deprecated public static ModuleAnnotatedMethodScanner scanner() { return new ModuleAnnotatedMethodScanner() { @Override public Set> annotationClasses() { return ImmutableSet.of(); } @Override public Key prepareMethod( Binder binder, Annotation annotation, Key key, InjectionPoint injectionPoint) { throw new IllegalStateException("Unexpected annotation: " + annotation); } }; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy