Interface ShadowProvider

All Known Implementing Classes:
Shadows, Shadows, Shadows, Shadows

public interface ShadowProvider
Interface implemented by packages that provide shadows to Robolectric.
  • Method Summary

    Modifier and Type Method Description
    String[] getProvidedPackageNames()
    Array of Java package names that are shadowed by this package.
    default Map<String,​String> getShadowPickerMap()
    Map of framework classes which may be represented by more than one shadow, to be picked at runtime.
    Collection<Map.Entry<String,​String>> getShadows()
    Return a collection of Map.Entry objects representing the mapping of class name to shadow name.
    void reset()
    Reset the static state of all shadows provided by this package.
  • Method Details

    • reset

      void reset()
      Reset the static state of all shadows provided by this package.
    • getProvidedPackageNames

      String[] getProvidedPackageNames()
      Array of Java package names that are shadowed by this package.
      Returns:
      Array of Java package names.
    • getShadows

      Collection<Map.Entry<String,​String>> getShadows()
      Return a collection of Map.Entry objects representing the mapping of class name to shadow name.

      This is a multimap instead of a regular map in order to support, for instance, multiple shadows per class that only differ by SDK level.

      It also uses a Collection<Entry<String, String>> as the return value to avoid having a dependency on something like Guava Multimap.

      Returns:
      Shadow mapping.
    • getShadowPickerMap

      default Map<String,​String> getShadowPickerMap()
      Map of framework classes which may be represented by more than one shadow, to be picked at runtime.
      Returns:
      A map from the name of the framework class to the name of its {#link org.robolectric.shadow.apiShadowPicker}.