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

org.hibernate.search.spi.InstanceInitializer Maven / Gradle / Ivy

There is a newer version: 5.11.12.Final
Show newest version
/*
 * Hibernate Search, full-text search for your domain model
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later
 * See the lgpl.txt file in the root directory or .
 */
package org.hibernate.search.spi;

import java.util.Collection;
import java.util.Map;

import org.hibernate.search.backend.spi.Work;

/**
 * When using the Hibernate Core integration (for example) we need to make sure that the
 * entities and collections we're working on are initialized.
 * Initialization strategies might vary according to the integrating framework;
 * when integrating with Infinispan (as Infinispan Query) no initialization is needed.
 *
 * @see org.hibernate.search.engine.impl.SimpleInitializer
 * @author Sanne Grinovero (C) 2011 Red Hat Inc.
 */
public interface InstanceInitializer {

	/**
	 * @param  the type of the entity
	 * @param entity an instance or proxy of T
	 * @return the class from the instance, or the underlying class from a proxy.
	 */
	 Class getClass(T entity);

	/**
	 * @param value the object to unproxy
	 * @return if value is a proxy, unwraps it, otherwise works as a pass-through function.
	 */
	Object unproxy(Object value);

	/**
	 * @param  the type of the elements in the collection
	 * @param value the collection to initialize
	 * @return the initialized Collection, to be used on lazily-loading collections
	 */
	 Collection initializeCollection(Collection value);

	/**
	 * @param  key
	 * @param  value
	 * @param value the map to initialize
	 * @return the initialized Map, to be used on lazily-loading maps
	 */
	 Map initializeMap(Map value);

	/**
	 * @param value the array to initialize
	 * @return the initialized array, to be used on lazily-loading arrays
	 */
	Object[] initializeArray(Object[] value);

	/**
	 * @param work
	 * @return the identification of the user type being indexed
	 */
	IndexedTypeIdentifier getIndexedTypeIdFromWork(Work work);

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy