org.apache.ojb.broker.core.proxy
Class ProxyHelper

java.lang.Object
  extended by org.apache.ojb.broker.core.proxy.ProxyHelper

public class ProxyHelper
extends java.lang.Object

ProxyHelper used to get the real thing behind a proxy

Version:
$Id: ProxyHelper.java 365232 2005-12-21 22:36:07Z tomdz $
Author:
Jakob Braeuchi

Constructor Summary
ProxyHelper()
           
 
Method Summary
static CollectionProxy getCollectionProxy(java.lang.Object item)
          Return CollectionProxy for item is item is a CollectionProxy, otherwise return null
static IndirectionHandler getIndirectionHandler(java.lang.Object obj)
          Returns the invocation handler object of the given proxy object.
static ProxyFactory getProxyFactory()
           
static java.lang.Class getRealClass(java.lang.Object objectOrProxy)
          Get the real Class
static java.lang.Object getRealObject(java.lang.Object objectOrProxy)
          Get the real Object
static java.lang.Object getRealObjectIfMaterialized(java.lang.Object objectOrProxy)
          Get the real Object for already materialized Handler
static boolean isCollectionProxy(java.lang.Object item)
          Reports if item is a CollectionProxy.
static boolean isMaterialized(java.lang.Object object)
          Determines whether the object is a materialized object, i.e. no proxy or a proxy that has already been loaded from the database.
static boolean isNormalOjbProxy(java.lang.Object proxyOrObject)
          Determines whether the given object is an OJB proxy.
static boolean isProxy(java.lang.Object proxyOrObject)
          Returns true if the given object is a Proxy or a VirtualProxy instance.
static boolean isVirtualOjbProxy(java.lang.Object proxyOrObject)
          Determines whether the given object is an OJB virtual proxy.
static java.lang.String toString(java.lang.Object object)
          Materialization-safe version of toString.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProxyHelper

public ProxyHelper()
Method Detail

getProxyFactory

public static ProxyFactory getProxyFactory()

getRealObject

public static final java.lang.Object getRealObject(java.lang.Object objectOrProxy)
Get the real Object

Parameters:
objectOrProxy -
Returns:
Object

getRealObjectIfMaterialized

public static final java.lang.Object getRealObjectIfMaterialized(java.lang.Object objectOrProxy)
Get the real Object for already materialized Handler

Parameters:
objectOrProxy -
Returns:
Object or null if the Handel is not materialized

getRealClass

public static final java.lang.Class getRealClass(java.lang.Object objectOrProxy)
Get the real Class

Parameters:
objectOrProxy -
Returns:
Class

isNormalOjbProxy

public static boolean isNormalOjbProxy(java.lang.Object proxyOrObject)
Determines whether the given object is an OJB proxy.

Returns:
true if the object is an OJB proxy

isVirtualOjbProxy

public static boolean isVirtualOjbProxy(java.lang.Object proxyOrObject)
Determines whether the given object is an OJB virtual proxy.

Returns:
true if the object is an OJB virtual proxy

isProxy

public static boolean isProxy(java.lang.Object proxyOrObject)
Returns true if the given object is a Proxy or a VirtualProxy instance.


getIndirectionHandler

public static IndirectionHandler getIndirectionHandler(java.lang.Object obj)
Returns the invocation handler object of the given proxy object.

Parameters:
obj - The object
Returns:
The invocation handler if the object is an OJB proxy, or null otherwise

isMaterialized

public static boolean isMaterialized(java.lang.Object object)
Determines whether the object is a materialized object, i.e. no proxy or a proxy that has already been loaded from the database.

Parameters:
object - The object to test
Returns:
true if the object is materialized

toString

public static java.lang.String toString(java.lang.Object object)
Materialization-safe version of toString. If the object is a yet-unmaterialized proxy, then only the text "unmaterialized proxy for ..." is returned and the proxy is NOT materialized. Otherwise, the normal toString method is called. This useful e.g. for logging etc.

Parameters:
object - The object for which a string representation shall be generated
Returns:
The string representation

getCollectionProxy

public static CollectionProxy getCollectionProxy(java.lang.Object item)
Return CollectionProxy for item is item is a CollectionProxy, otherwise return null


isCollectionProxy

public static boolean isCollectionProxy(java.lang.Object item)
Reports if item is a CollectionProxy.



(C) 2002 - 2006 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.4, 2005-12-30