org.jboss.arquillian.core.spi
Interface ServiceLoader

All Known Implementing Classes:
ServiceRegistryLoader

public interface ServiceLoader

ServiceLoader

Version:
$Revision: $
Author:
Aslak Knutsen

Method Summary
<T> Collection<T>
all(Class<T> serviceClass)
          Load multiple service implementations.
<T> T
onlyOne(Class<T> serviceClass)
          Load a single service implementation.
<T> T
onlyOne(Class<T> serviceClass, Class<? extends T> defaultServiceClass)
          Load a single service implementation.
 

Method Detail

all

<T> Collection<T> all(Class<T> serviceClass)
Load multiple service implementations.

Type Parameters:
T -
Parameters:
serviceClass - The service interface to load a implementations for
Returns:
A Collection of all instances of serviceClass

onlyOne

<T> T onlyOne(Class<T> serviceClass)
Load a single service implementation. Method should throw IllegalStateException if multiple instances of serviceClass found.

Type Parameters:
T -
Parameters:
serviceClass - The service interface to load a implementation for
Returns:
A instance of serviceClass
Throws:
IllegalStateException - if more then one implementation of serviceClass found

onlyOne

<T> T onlyOne(Class<T> serviceClass,
              Class<? extends T> defaultServiceClass)
Load a single service implementation. Method should returns a new instance of defaultServiceClass if no other instance is found.

Type Parameters:
T -
Parameters:
serviceClass - The service interface to load a implementation for
defaultServiceClass - If no other implementations found, create a instance of this class
Returns:
A instance of serviceClass


Copyright © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.