Service (Apache Ant API)
Date: 2018-07-10

org.apache.tools.ant.types.spi

## Class Service

- java.lang.Object
- - org.apache.tools.ant.ProjectComponent
  - - org.apache.tools.ant.types.spi.Service

- All Implemented Interfaces:
    java.lang.Cloneable

      public class Service
      extends ProjectComponent

  ANT Jar-Task SPI extension
  See Also:
    http://issues.apache.org/bugzilla/show_bug.cgi?id=31520

- - ### Field Summary

    - ### Fields inherited from class org.apache.tools.ant.ProjectComponent

      `description, location, project`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Service()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addConfiguredProvider(Provider provider)` Add a nested provider element.
    `void` | `check()` Check if this object is configured correctly as a nested element.
    `java.io.InputStream` | `getAsStream()` Return the implementations of this services as an inputstream.
    `java.lang.String` | `getType()`
    `void` | `setProvider(java.lang.String className)` Set the provider classname.
    `void` | `setType(java.lang.String type)` Set the service type.

    - ### Methods inherited from class org.apache.tools.ant.ProjectComponent

      `clone, getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Service

          public Service()

  - ### Method Detail

    - #### setProvider

          public void setProvider(java.lang.String className)

      Set the provider classname.
      Parameters:
        `className` - the classname of a provider of this service.

    - #### addConfiguredProvider

          public void addConfiguredProvider(Provider provider)

      Add a nested provider element.
      Parameters:
        `provider` - a provider element.

    - #### getType

          public java.lang.String getType()

      Returns:
        the service type.

    - #### setType

          public void setType(java.lang.String type)

      Set the service type.
      Parameters:
        `type` - the service type, a classname of an interface or a class (normally abstract).

    - #### getAsStream

          public java.io.InputStream getAsStream()
                                          throws java.io.IOException

      Return the implementations of this services as an inputstream.
      Returns:
        an inputstream of the classname names encoded as UTF-8.
      Throws:
        `java.io.IOException` - if there is an error.

    - #### check

          public void check()

      Check if this object is configured correctly as a nested element.