Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/java/util/ServiceLoader.Provider#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/java/util/ServiceLoader.Provider#inhmethods)

# ServiceLoader.Provider

` public static interface ServiceLoader.Provider `   
` implements https://developer.android.com/reference/java/util/function/Supplier<S> `

|---|
| java.util.ServiceLoader.Provider\<S\> |

<br />

*** ** * ** ***

Represents a service provider located by `ServiceLoader`.

When using a loader's `https://developer.android.com/reference/java/util/ServiceLoader#stream()` method then the elements are of type `Provider`. This allows processing to select or filter on the provider class without instantiating the provider.

<br />

## Summary

| ### Public methods ||
|---|---|
| ` abstract S` | ` https://developer.android.com/reference/java/util/ServiceLoader.Provider#get()() ` Returns an instance of the provider. |
| ` abstract https://developer.android.com/reference/java/lang/Class<? extends S>` | ` https://developer.android.com/reference/java/util/ServiceLoader.Provider#type()() ` Returns the provider type. |

### Inherited methods

From interface ` https://developer.android.com/reference/java/util/function/Supplier ` ` abstract S` ` https://developer.android.com/reference/java/util/function/Supplier#get()() `

Gets a result.

## Public methods

### get

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract S get ()
```

Returns an instance of the provider.

<br />

| Returns ||
|---|---|
| `S` | An instance of the provider. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/util/ServiceConfigurationError` | If the service provider cannot be instantiated, or in the case of a provider factory, the public static "`provider()`" method returns `null` or throws an error or exception. The `ServiceConfigurationError` will carry an appropriate cause where possible. |

### type

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract Class<? extends S> type ()
```

Returns the provider type. There is no guarantee that this type is accessible or that it has a public no-args constructor. The `https://developer.android.com/reference/java/util/ServiceLoader.Provider#get()` method should be used to obtain the provider instance.

When a module declares that the provider class is created by a provider factory then this method returns the return type of its public static "`provider()`" method.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/Class<? extends S>` | The provider type <br /> |