org.hibernate.search.cfg.impl

## Class DelegatingClassLoaderService

- java.lang.Object
- - org.hibernate.search.cfg.impl.DelegatingClassLoaderService

- All Implemented Interfaces:
    ClassLoaderService, Service

      public class DelegatingClassLoaderService
      extends Object
      implements ClassLoaderService

  An implementation of class loader service which delegates to the ORM provided `ClassLoaderService`. If class, resource or service loading fails in ORM class loader, the current class loader is checked.
  Author:
    Hardy Ferentschik

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DelegatingClassLoaderService(ClassLoaderService hibernateClassLoaderService)`

  - ### Method Summary

    All Methods Instance Methods Concrete 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.

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

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

- - ### Constructor Detail

    - #### DelegatingClassLoaderService

          public DelegatingClassLoaderService(ClassLoaderService hibernateClassLoaderService)

  - ### Method Detail

    - #### classForName

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

      Description copied from interface: `ClassLoaderService`
      Locate a class by name.
      Specified by:
        `classForName` in interface `ClassLoaderService`
      Type Parameters:
        `T` - The returned class type.
      Parameters:
        `className` - The name of the class to locate
      Returns:
        The class reference

    - #### locateResource

          public URL locateResource(String name)

      Description copied from interface: `ClassLoaderService`
      Locate a resource by name (classpath lookup).
      Specified by:
        `locateResource` in interface `ClassLoaderService`
      Parameters:
        `name` - The resource name.
      Returns:
        The located URL; may return `null` to indicate the resource was not found

    - #### locateResourceStream

          public InputStream locateResourceStream(String name)

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

    - #### loadJavaServices

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

      Description copied from interface: `ClassLoaderService`
      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`.

      Specified by:
        `loadJavaServices` in interface `ClassLoaderService`
      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