Package org.hibernate.service
Interface ServiceRegistry
-
- All Superinterfaces:
java.lang.AutoCloseable
- All Known Subinterfaces:
BootstrapServiceRegistry
,ServiceRegistryImplementor
,SessionFactoryServiceRegistry
,StandardServiceRegistry
- All Known Implementing Classes:
org.hibernate.service.internal.AbstractServiceRegistryImpl
,ServiceRegistryTestingImpl
,org.hibernate.boot.registry.internal.StandardServiceRegistryImpl
public interface ServiceRegistry extends java.lang.AutoCloseable
A registry ofservices
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
close()
ServiceRegistry
getParentServiceRegistry()
Retrieve this registry's parent registry.<R extends Service>
RgetService(java.lang.Class<R> serviceRole)
Retrieve a service by role.default <R extends Service>
RrequireService(java.lang.Class<R> serviceRole)
Retrieve a service by role.
-
-
-
Method Detail
-
getParentServiceRegistry
ServiceRegistry getParentServiceRegistry()
Retrieve this registry's parent registry.- Returns:
- The parent registry. May be null.
-
getService
<R extends Service> R getService(java.lang.Class<R> serviceRole)
Retrieve a service by role. If service is not found, but aServiceInitiator
is registered for this service role, the service will be initialized and returned. NOTE: We cannot return<R extends Service<T>>
here because the service might come from the parent...- Type Parameters:
R
- The service role type- Parameters:
serviceRole
- The service role- Returns:
- The requested service or null if the service was not found.
- Throws:
UnknownServiceException
- Indicates the service was not known.
-
requireService
default <R extends Service> R requireService(java.lang.Class<R> serviceRole)
Retrieve a service by role. If service is not found, but aServiceInitiator
is registered for this service role, the service will be initialized and returned. NOTE: We cannot return<R extends Service<T>>
here because the service might come from the parent...- Type Parameters:
R
- The service role type- Parameters:
serviceRole
- The service role- Returns:
- The requested service .
- Throws:
UnknownServiceException
- Indicates the service was not known.NullServiceException
- Indicates the service was null.
-
close
void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
-
-