Class NetworkSpecifierFactory

java.lang.Object
org.robolectric.shadows.NetworkSpecifierFactory

@RequiresApi(26) public final class NetworkSpecifierFactory extends Object
Factory to create NetworkSpecifier types that are hidden on certain SDK levels.
  • Method Details

    • newStringNetworkSpecifier

      public static NetworkSpecifier newStringNetworkSpecifier(String specifier)
      Constructs a new StringNetworkSpecifier instance, which has remained hidden on all SDKs (as of U), but has existed since the NetworkSpecifier hierarchy was created in O to represent a few more niche specifier types without defining a full-blown subclass of NetworkSpecifier for each of their particular use cases. These meanings typically stabilize over time and then gain a concrete NetworkSpecifier subtype in the public SDK, which tests should prefer when available.

      Depending on the specifier string's content, the returned instance will have one of several different meanings. See NetworkRequest.Builder.setNetworkSpecifier(String) documentation for more detail.