All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.search.engine.common.impl.SearchIntegrationHandle Maven / Gradle / Ivy

There is a newer version: 8.0.0.Alpha1
Show newest version
/*
 * SPDX-License-Identifier: Apache-2.0
 * Copyright Red Hat Inc. and Hibernate Authors
 */
package org.hibernate.search.engine.common.impl;

import java.lang.invoke.MethodHandles;

import org.hibernate.search.engine.common.spi.SearchIntegration;
import org.hibernate.search.engine.logging.impl.Log;
import org.hibernate.search.util.common.logging.impl.LoggerFactory;

final class SearchIntegrationHandle implements SearchIntegration.Handle {

	private static final Log log = LoggerFactory.make( Log.class, MethodHandles.lookup() );

	private SearchIntegration integration;

	void initialize(SearchIntegration integration) {
		this.integration = integration;
	}

	@Override
	public SearchIntegration getOrFail() {
		if ( integration == null ) {
			throw log.noIntegrationBecauseInitializationNotComplete();
		}
		return integration;
	}

	@Override
	public SearchIntegration getOrNull() {
		return integration;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy