Class JOPALazyUtils

java.lang.Object
cz.cvut.kbss.jopa.utils.JOPALazyUtils

public class JOPALazyUtils extends Object
Utilities related to lazy loading.
  • Method Details

    • isLazyLoadingProxy

      public static boolean isLazyLoadingProxy(Object object)
      Checks if this specified object is a lazy loading proxy (instance of LazyLoadingProxy).
      Parameters:
      object - Object to investigate
      Returns:
      true if argument is lazy loading proxy, false otherwise
    • load

      public static void load(Object proxy)
      Triggers loading on the specified lazy loading proxy.

      If the specified object is not a LazyLoadingProxy or is a proxy that is already loaded, nothing happens.

      Parameters:
      proxy - Proxy to load
    • isLoaded

      public static boolean isLoaded(Object proxy)
      Checks whether the specified object has been loaded or is still a lazy loading proxy.
      Parameters:
      proxy - Proxy to check
      Returns:
      true if the object is a LazyLoadingProxy and is not loaded, false otherwise
    • getClass

      public static Class<?> getClass(Object proxy)
      Gets the class represented by the specified lazy loading proxy.

      If the specified object proxies an entity, the corresponding entity class is returned. If the object proxies a collection, the corresponding interface is returned. If the specified object is not a LazyLoadingProxy, its runtime class is returned.

      Parameters:
      proxy - Proxy whose class to get
      Returns:
      Runtime class unwrapped from a lazy loading proxy