Top Description Methods
org.hibernate.service

public Interface ServiceRegistry

extends AutoCloseable
Known Direct Subinterfaces
org.hibernate.service.spi.ServiceRegistryImplementor, org.hibernate.boot.registry.BootstrapServiceRegistry, org.hibernate.boot.registry.StandardServiceRegistry

A registry of services.
Author
Steve Ebersole

Method Summary

Modifier and TypeMethod and Description
public void
close()

Redeclares java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.
public ServiceRegistry

Returns:

The parent registry. May be null.
getParentServiceRegistry
()

Retrieve this registry's parent registry.

public <
The service role type
R extends Service
>
R

Returns:

The requested service or null if the service was not found.
getService
(Class<R>
The service role
serviceRole
)

Retrieve a service by role.

public default <
The service role type
R extends Service
>
R

Returns:

The requested service .
requireService
(Class<R>
The service role
serviceRole
)

Retrieve a service by role.

Method Detail

closeback to summary
public void close()

Redeclares java.lang.AutoCloseable.close.

Doc from java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

Annotations
@Override
getParentServiceRegistryback to summary
public ServiceRegistry getParentServiceRegistry()

Retrieve this registry's parent registry.

Returns:ServiceRegistry

The parent registry. May be null.

getServiceback to summary
public <R extends Service> R getService(Class<R> serviceRole)

Retrieve a service by role. If service is not found, but a org.hibernate.service.spi.ServiceInitiator 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...

Parameters
<R>
The service role type
serviceRole:Class<R>

The service role

Returns:R

The requested service or null if the service was not found.

Exceptions
UnknownServiceException:
Indicates the service was not known.
requireServiceback to summary
public default <R extends Service> R requireService(Class<R> serviceRole)

Retrieve a service by role. If service is not found, but a org.hibernate.service.spi.ServiceInitiator 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...

Parameters
<R>
The service role type
serviceRole:Class<R>

The service role

Returns:R

The requested service .

Exceptions
UnknownServiceException:
Indicates the service was not known.
NullServiceException:
Indicates the service was null.