org.hibernate.search.engine.service.classloading.spi

## Interface ClassLoaderService

- All Superinterfaces:
    Service
  All Known Implementing Classes:
    DefaultClassLoaderService, DelegatingClassLoaderService

      public interface ClassLoaderService
      extends Service

  A service for interacting with class loaders.
  Author:
    Steve Ebersole, Hardy Ferentschik

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `<T> Class<T>` | `classForName(String className)` Locate a class by name.
    `<T> Iterable<T>` | `loadJavaServices(Class<T> serviceContract)` Discovers and instantiates implementations of the named service contract.
    `URL` | `locateResource(String name)` Locate a resource by name (classpath lookup).
    `InputStream` | `locateResourceStream(String name)` Locate a resource by name (classpath lookup) and gets its stream.

- - ### Method Detail

    - #### classForName

          <T> Class<T> classForName(String className)

      Locate a class by name.
      Type Parameters:
        `T` - The returned class type.
      Parameters:
        `className` - The name of the class to locate
      Returns:
        The class reference
      Throws:
        `ClassLoadingException` - Indicates the class could not be found

    - #### locateResource

          URL locateResource(String name)

      Locate a resource by name (classpath lookup).
      Parameters:
        `name` - The resource name.
      Returns:
        The located URL; may return `null` to indicate the resource was not found

    - #### locateResourceStream

          InputStream locateResourceStream(String name)

      Locate a resource by name (classpath lookup) and gets its stream.
      Parameters:
        `name` - The resource name.
      Returns:
        The stream of the located resource; may return `null` to indicate the resource was not found

    - #### loadJavaServices

          <T> Iterable<T> loadJavaServices(Class<T> serviceContract)

      Discovers and instantiates implementations of the named service contract.

      NOTE : the terms service here is used differently than `Service`. Instead here we are talking about services as defined by `ServiceLoader`.

      Type Parameters:
        `T` - The type of the service contract
      Parameters:
        `serviceContract` - The java type defining the service contract
      Returns:
        The ordered set of discovered services.

Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved