本文整理汇总了Java中org.apache.ojb.broker.core.proxy.ProxyHelper.isProxy方法的典型用法代码示例。如果您正苦于以下问题:Java ProxyHelper.isProxy方法的具体用法?Java ProxyHelper.isProxy怎么用?Java ProxyHelper.isProxy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ojb.broker.core.proxy.ProxyHelper
的用法示例。
在下文中一共展示了ProxyHelper.isProxy方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: materializeClassForProxiedObject
import org.apache.ojb.broker.core.proxy.ProxyHelper; //导入方法依赖的package包/类
/**
* Attempts to find the Class for the given potentially proxied object
*
* @param object the potentially proxied object to find the Class of
* @return the best Class which could be found for the given object
*/
public static Class materializeClassForProxiedObject(Object object) {
if (object == null) {
return null;
}
// if (object instanceof HibernateProxy) {
// final Class realClass = ((HibernateProxy) object).getHibernateLazyInitializer().getPersistentClass();
// return realClass;
// }
if (ProxyHelper.isProxy(object) || ProxyHelper.isCollectionProxy(object)) {
return ProxyHelper.getRealClass(object);
}
return object.getClass();
}
示例2: isNull
import org.apache.ojb.broker.core.proxy.ProxyHelper; //导入方法依赖的package包/类
/**
* This method is a OJB Proxy-safe way to test for null on a proxied object that may or may not be materialized yet.
* It is safe
* to use on a proxy (materialized or non-materialized) or on a non-proxy (ie, regular object). Note that this will
* force a
* materialization of the proxy if the object is a proxy and unmaterialized.
*
* @param object - any object, proxied or not, materialized or not
* @return true if the object (or underlying materialized object) is null, false otherwise
*/
public static boolean isNull(Object object) {
// regardless, if its null, then its null
if (object == null) {
return true;
}
// only try to materialize the object to see if its null if this is a
// proxy object
if (ProxyHelper.isProxy(object) || ProxyHelper.isCollectionProxy(object)) {
if (ProxyHelper.getRealObject(object) == null) {
return true;
}
}
// JPA does not provide a way to determine if an object is a proxy, instead we invoke
// the equals method and catch an EntityNotFoundException
try {
object.equals(null);
} catch (EntityNotFoundException e) {
return true;
}
return false;
}
示例3: lockAndRegisterReferences
import org.apache.ojb.broker.core.proxy.ProxyHelper; //导入方法依赖的package包/类
/**
* we only use the registrationList map if the object is not a proxy. During the
* reference locking, we will materialize objects and they will enter the registered for
* lock map.
*/
private void lockAndRegisterReferences(ClassDescriptor cld, Object sourceObject, int lockMode, List registeredObjects) throws LockNotGrantedException
{
if (implicitLocking)
{
Iterator i = cld.getObjectReferenceDescriptors(true).iterator();
while (i.hasNext())
{
ObjectReferenceDescriptor rds = (ObjectReferenceDescriptor) i.next();
Object refObj = rds.getPersistentField().get(sourceObject);
if (refObj != null)
{
boolean isProxy = ProxyHelper.isProxy(refObj);
RuntimeObject rt = isProxy ? new RuntimeObject(refObj, this, false) : new RuntimeObject(refObj, this);
if (!registrationList.contains(rt.getIdentity()))
{
lockAndRegister(rt, lockMode, registeredObjects);
}
}
}
}
}
示例4: afterLoading
import org.apache.ojb.broker.core.proxy.ProxyHelper; //导入方法依赖的package包/类
/**
* Remove colProxy from list of pending collections and
* register its contents with the transaction.
*/
public void afterLoading(CollectionProxyDefaultImpl colProxy)
{
if (log.isDebugEnabled()) log.debug("loading a proxied collection a collection: " + colProxy);
Collection data = colProxy.getData();
for (Iterator iterator = data.iterator(); iterator.hasNext();)
{
Object o = iterator.next();
if(!isOpen())
{
log.error("Collection proxy materialization outside of a running tx, obj=" + o);
try{throw new Exception("Collection proxy materialization outside of a running tx, obj=" + o);}
catch(Exception e)
{e.printStackTrace();}
}
else
{
Identity oid = getBroker().serviceIdentity().buildIdentity(o);
ClassDescriptor cld = getBroker().getClassDescriptor(ProxyHelper.getRealClass(o));
RuntimeObject rt = new RuntimeObject(o, oid, cld, false, ProxyHelper.isProxy(o));
lockAndRegister(rt, Transaction.READ, isImplicitLocking(), getRegistrationList());
}
}
unregisterFromCollectionProxy(colProxy);
}
示例5: assertValidPkForDelete
import org.apache.ojb.broker.core.proxy.ProxyHelper; //导入方法依赖的package包/类
/**
* returns true if the primary key fields are valid for delete, else false.
* PK fields are valid if each of them contains a valid non-null value
* @param cld the ClassDescriptor
* @param obj the object
* @return boolean
*/
public boolean assertValidPkForDelete(ClassDescriptor cld, Object obj)
{
if(!ProxyHelper.isProxy(obj))
{
FieldDescriptor fieldDescriptors[] = cld.getPkFields();
int fieldDescriptorSize = fieldDescriptors.length;
for(int i = 0; i < fieldDescriptorSize; i++)
{
FieldDescriptor fd = fieldDescriptors[i];
Object pkValue = fd.getPersistentField().get(obj);
if (representsNull(fd, pkValue))
{
return false;
}
}
}
return true;
}
示例6: materializeClassForProxiedObject
import org.apache.ojb.broker.core.proxy.ProxyHelper; //导入方法依赖的package包/类
/**
* Attempts to find the Class for the given potentially proxied object
*
* @param object the potentially proxied object to find the Class of
* @return the best Class which could be found for the given object
*/
public static Class materializeClassForProxiedObject(Object object) {
if (object == null) {
return null;
}
if (object instanceof HibernateProxy) {
final Class realClass = ((HibernateProxy) object).getHibernateLazyInitializer().getPersistentClass();
return realClass;
}
if (ProxyHelper.isProxy(object) || ProxyHelper.isCollectionProxy(object)) {
return ProxyHelper.getRealClass(object);
}
return object.getClass();
}
示例7: refreshAttachment
import org.apache.ojb.broker.core.proxy.ProxyHelper; //导入方法依赖的package包/类
/**
* The attachment BO is proxied in OJB. For some reason when an attachment does not yet exist,
* refreshReferenceObject is not returning null and the proxy cannot be materialized. So, this method exists to
* properly handle the proxied attachment BO. This is a hack and should be removed post JPA migration.
*/
protected void refreshAttachment() {
if (KRADUtils.isNull(attachment)) {
this.refreshReferenceObject("attachment");
final boolean isProxy = attachment != null && ProxyHelper.isProxy(attachment);
if (isProxy && ProxyHelper.getRealObject(attachment) == null) {
attachment = null;
}
}
}
示例8: refreshAttachmentList
import org.apache.ojb.broker.core.proxy.ProxyHelper; //导入方法依赖的package包/类
protected void refreshAttachmentList() {
if (KRADUtils.isNull(attachments)) {
this.refreshReferenceObject("attachments");
final boolean isProxy = attachments != null && ProxyHelper.isProxy(attachments);
if (isProxy && ProxyHelper.getRealObject(attachments) == null) {
attachments = null;
}
}
}
示例9: refreshAttachment
import org.apache.ojb.broker.core.proxy.ProxyHelper; //导入方法依赖的package包/类
/**
* The attachment BO is proxied in OJB. For some reason when an attachment does not yet exist,
* refreshReferenceObject is not returning null and the proxy cannot be materialized. So, this method exists to
* properly handle the proxied attachment BO. This is a hack and should be removed post JPA migration.
*/
protected void refreshAttachment() {
if (ObjectUtils.isNull(attachment)) {
this.refreshReferenceObject("attachment");
final boolean isProxy = attachment != null && ProxyHelper.isProxy(attachment);
if (isProxy && ProxyHelper.getRealObject(attachment) == null) {
attachment = null;
}
}
}
示例10: refreshAttachmentList
import org.apache.ojb.broker.core.proxy.ProxyHelper; //导入方法依赖的package包/类
protected void refreshAttachmentList() {
if (ObjectUtils.isNull(attachments)) {
this.refreshReferenceObject("attachments");
final boolean isProxy = attachments != null && ProxyHelper.isProxy(attachments);
if (isProxy && ProxyHelper.getRealObject(attachments) == null) {
attachments = null;
}
}
}
示例11: isProxied
import org.apache.ojb.broker.core.proxy.ProxyHelper; //导入方法依赖的package包/类
/**
* Asks proper DAO implementation if the object is proxied
*
* @see org.kuali.rice.krad.dao.PersistenceDao#isProxied(java.lang.Object)
*/
public boolean isProxied(Object object) {
//if (object instanceof HibernateProxy) return true;
if (ProxyHelper.isProxy(object)) return true;
return false;
}
示例12: isProxied
import org.apache.ojb.broker.core.proxy.ProxyHelper; //导入方法依赖的package包/类
/**
* Asks proper DAO implementation if the object is proxied
*
* @see org.kuali.rice.krad.dao.PersistenceDao#isProxied(java.lang.Object)
*/
public boolean isProxied(Object object) {
if (object instanceof HibernateProxy) return true;
if (ProxyHelper.isProxy(object)) return true;
return false;
}
示例13: isProxied
import org.apache.ojb.broker.core.proxy.ProxyHelper; //导入方法依赖的package包/类
/**
* Asks ProxyHelper if the object is proxied
*
* @see org.kuali.rice.krad.dao.PersistenceDao#isProxied(java.lang.Object)
*/
@Override
public boolean isProxied(Object object) {
return ProxyHelper.isProxy(object);
}
示例14: isProxied
import org.apache.ojb.broker.core.proxy.ProxyHelper; //导入方法依赖的package包/类
/**
* Asks ProxyHelper if the object is proxied
*
* @see org.kuali.rice.krad.dao.PersistenceDao#isProxied(java.lang.Object)
*/
public boolean isProxied(Object object) {
return ProxyHelper.isProxy(object);
}