# Provider.Service

public static class **Provider.Service** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
The description of a security service. It encapsulates the properties
of a service and contains a factory method to obtain new implementation
instances of this service.

Each service has a provider that offers the service, a type,
an algorithm name, and the name of the class that implements the
service. Optionally, it also includes a list of alternate algorithm
names for this service (aliases) and attributes, which are a map of
(name, value) String pairs.

This class defines the methods `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Provider.Service.html#supportsParameter(java.lang.Object)` and `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Provider.Service.html#newInstance(java.lang.Object)`
which are used by the Java security framework when it searches for
suitable services and instantiates them. The valid arguments to those
methods depend on the type of service. For the service types defined
within Java SE, see the
[Java Cryptography Architecture API Specification \& Reference](https://developers.google.com/j2objc/javadoc/jre/technotes/guides/security/crypto/CryptoSpec.html)
for the valid values.
Note that components outside of Java SE can define additional types of
services and their behavior.

Instances of this class are immutable.

### Public Constructor Summary

|---|---|
|   | [Service](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Provider.Service.html#Service(java.security.Provider,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20java.util.List<java.lang.String>,%20java.util.Map<java.lang.String,%20java.lang.String>))([Provider](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Provider.html) provider, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) type, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) algorithm, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) className, [List](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/List.html)\<[String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)\> aliases, [Map](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.html)\<[String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html), [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)\> attributes) Construct a new service. |

### Public Method Summary

|---|---|
| final [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getAlgorithm](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Provider.Service.html#getAlgorithm())() Return the name of the algorithm of this service. |
| final [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getAttribute](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Provider.Service.html#getAttribute(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name) Return the value of the specified attribute or null if this attribute is not set for this Service. |
| final [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getClassName](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Provider.Service.html#getClassName())() Return the name of the class implementing this service. |
| final [Provider](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Provider.html) | [getProvider](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Provider.Service.html#getProvider())() Return the Provider of this service. |
| final [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getType](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Provider.Service.html#getType())() Get the type of this service. |
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [newInstance](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Provider.Service.html#newInstance(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) constructorParameter) Return a new instance of the implementation described by this service. |
| boolean | [supportsParameter](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Provider.Service.html#supportsParameter(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) parameter) Test whether this Service can use the specified parameter. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Provider.Service.html#toString())() Return a String representation of this service. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

## Public Constructors

#### public
**Service**
([Provider](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Provider.html) provider, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) type, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) algorithm, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) className, [List](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/List.html)\<[String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)\> aliases, [Map](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.html)\<[String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html), [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)\> attributes)

Construct a new service.

##### Parameters

| provider | the provider that offers this service |
| type | the type of this service |
| algorithm | the algorithm name |
| className | the name of the class implementing this service |
| aliases | List of aliases or null if algorithm has no aliases |
| attributes | Map of attributes or null if this implementation has no attributes |
|---|---|

##### Throws

| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if provider, type, algorithm, or className is null |
|---|---|

## Public Methods

#### public final [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getAlgorithm**
()

Return the name of the algorithm of this service. For example,
`SHA-1`.

##### Returns

- the algorithm of this service

#### public final [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getAttribute**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name)

Return the value of the specified attribute or null if this
attribute is not set for this Service.

##### Parameters

| name | the name of the requested attribute |
|---|---|

##### Returns

- the value of the specified attribute or null if the attribute is not present

##### Throws

| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if name is null |
|---|---|

#### public final [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getClassName**
()

Return the name of the class implementing this service.

##### Returns

- the name of the class implementing this service

#### public final [Provider](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Provider.html)
**getProvider**
()

Return the Provider of this service.

##### Returns

- the Provider of this service

#### public final [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getType**
()

Get the type of this service. For example, `MessageDigest`.

##### Returns

- the type of this service

#### public [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)
**newInstance**
([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) constructorParameter)

Return a new instance of the implementation described by this
service. The security provider framework uses this method to
construct implementations. Applications will typically not need
to call it.

The default implementation uses reflection to invoke the
standard constructor for this type of service.
Security providers can override this method to implement
instantiation in a different way.
For details and the values of constructorParameter that are
valid for the various types of services see the
[Java Cryptography Architecture API Specification \&
Reference](https://developers.google.com/j2objc/javadoc/jre/technotes/guides/security/crypto/CryptoSpec.html).

##### Parameters

| constructorParameter | the value to pass to the constructor, or null if this type of service does not use a constructorParameter. |
|---|---|

##### Returns

- a new implementation of this service

##### Throws

| [InvalidParameterException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/InvalidParameterException.html) | if the value of constructorParameter is invalid for this type of service. |
| [NoSuchAlgorithmException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/NoSuchAlgorithmException.html) | if instantiation failed for any other reason. |
|---|---|

#### public boolean
**supportsParameter**
([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) parameter)

Test whether this Service can use the specified parameter.
Returns false if this service cannot use the parameter. Returns
true if this service can use the parameter, if a fast test is
infeasible, or if the status is unknown.

The security provider framework uses this method with
some types of services to quickly exclude non-matching
implementations for consideration.
Applications will typically not need to call it.

For details and the values of parameter that are valid for the
various types of services see the top of this class and the
[Java Cryptography Architecture API Specification \&
Reference](https://developers.google.com/j2objc/javadoc/jre/technotes/guides/security/crypto/CryptoSpec.html).
Security providers can override it to implement their own test.

##### Parameters

| parameter | the parameter to test |
|---|---|

##### Returns

- false if this this service cannot use the specified parameter; true if it can possibly use the parameter

##### Throws

| [InvalidParameterException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/InvalidParameterException.html) | if the value of parameter is invalid for this type of service or if this method cannot be used with this type of service |
|---|---|

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**toString**
()

Return a String representation of this service.

##### Returns

- a String representation of this service.