Class ProxyHelper


  • public final class ProxyHelper
    extends java.lang.Object
    Author:
    Uwe Schaefer, (us@thomas-daily.de)
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Class getReferentClass​(java.lang.Object entity)
      Returns the class backing this entity
      static boolean isFetched​(java.lang.Object entity)
      Checks if the proxied entity has been fetched.
      static boolean isProxied​(java.lang.Class<?> clazz)
      Checks if the Class passed is a ProxiedReference
      static boolean isProxy​(java.lang.Object entity)
      Checks if the Java reference passed is a proxy
      static boolean isUnFetched​(java.lang.Object entity)
      Checks if the proxied entity has been fetched.
      static <T> T unwrap​(T entity)
      If proxied, returns the unwrapped entity.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • unwrap

        public static <T> T unwrap​(T entity)
        If proxied, returns the unwrapped entity.
        Type Parameters:
        T - the type of the entity
        Parameters:
        entity - the entity to check
        Returns:
        the bare entity
      • isProxy

        public static boolean isProxy​(java.lang.Object entity)
        Checks if the Java reference passed is a proxy
        Parameters:
        entity - the entity to check
        Returns:
        true if the reference is a proxied reference
      • isProxied

        public static boolean isProxied​(java.lang.Class<?> clazz)
        Checks if the Class passed is a ProxiedReference
        Parameters:
        clazz - the class to check
        Returns:
        true if the class is a ProxiedReference
      • getReferentClass

        public static java.lang.Class getReferentClass​(java.lang.Object entity)
        Returns the class backing this entity
        Parameters:
        entity - the entity to check
        Returns:
        if proxied, the Class of the proxied type. the entity's Class otherwise
      • isUnFetched

        public static boolean isUnFetched​(java.lang.Object entity)
        Checks if the proxied entity has been fetched.
        Parameters:
        entity - the entity to check
        Returns:
        true if the proxy hasn't been fetched.
      • isFetched

        public static boolean isFetched​(java.lang.Object entity)
        Checks if the proxied entity has been fetched.
        Parameters:
        entity - the entity to check
        Returns:
        true if the proxy has been fetched.