org.qi4j.api.service.importer
Class ServiceInstanceImporter<T>
java.lang.Object
org.qi4j.api.service.importer.ServiceInstanceImporter<T>
- All Implemented Interfaces:
- ServiceImporter<T>
public class ServiceInstanceImporter<T>
- extends java.lang.Object
- implements ServiceImporter<T>
Use a registered service that implements ServiceImporter to do the actual
import. The service id of the service that this importer should delegate to must
be set as meta-info on this service. Example:
module.services(MyServiceImporterService.class).identifiedBy("someid");
module.importedServices(OtherService.class).importedBy(ServiceInstanceImporter.class).setMetaInfo("someid");
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ServiceInstanceImporter
public ServiceInstanceImporter()
importService
public T importService(ImportedServiceDescriptor importedServiceDescriptor)
throws ServiceImporterException
- Description copied from interface:
ServiceImporter
- Imports an instance of the service type described in the service descriptor.
- Specified by:
importService
in interface ServiceImporter<T>
- Parameters:
importedServiceDescriptor
- The service descriptor.
- Returns:
- The imported service instance.
- Throws:
ServiceImporterException
- if import failed.
isAvailable
public boolean isAvailable(T instance)
- Description copied from interface:
ServiceImporter
- Ask if the service is available or not.
- Specified by:
isAvailable
in interface ServiceImporter<T>
- Parameters:
instance
- the instance to be checked
- Returns:
- true if the service is available, false if not