org.hibernate.search.spi
Interface InstanceInitializer

All Known Implementing Classes:
HibernateSessionLoadingInitializer, HibernateStatelessInitializer, SimpleInitializer

public interface InstanceInitializer

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.

Author:
Sanne Grinovero <sanne@hibernate.org> (C) 2011 Red Hat Inc.
See Also:
SimpleInitializer

Method Summary
<T> Class<T>
getClass(T entity)
           
<T> Class<T>
getClassFromWork(Work<T> work)
           
 Object[] initializeArray(Object[] value)
           
<T> Collection<T>
initializeCollection(Collection<T> value)
           
<K,V> Map<K,V>
initializeMap(Map<K,V> value)
           
 Object unproxy(Object value)
           
 

Method Detail

getClassFromWork

<T> Class<T> getClassFromWork(Work<T> work)

getClass

<T> Class<T> getClass(T entity)
Parameters:
entity - an instance or proxy of T
Returns:
the class from the instance, or the underlying class from a proxy.

unproxy

Object unproxy(Object value)
Parameters:
value - the object to unproxy
Returns:
if value is a proxy, unwraps it, otherwise works as a pass-through function.

initializeCollection

<T> Collection<T> initializeCollection(Collection<T> value)
Parameters:
value - the collection to initialize
Returns:
the initialized Collection, to be used on lazily-loading collections

initializeMap

<K,V> Map<K,V> initializeMap(Map<K,V> value)
Parameters:
value - the map to initialize
Returns:
the initialized Map, to be used on lazily-loading maps

initializeArray

Object[] initializeArray(Object[] value)
Parameters:
value - the array to initialize
Returns:
the initialized array, to be used on lazily-loading arrays


Copyright © 2006-2012 Red Hat Middleware, LLC. All Rights Reserved