org.test4j.hamcrest.matcher.property.comparator
类 HibernateProxyComparator

java.lang.Object
  继承者 org.test4j.hamcrest.matcher.property.comparator.HibernateProxyComparator
所有已实现的接口:
Comparator

public class HibernateProxyComparator
extends Object
implements Comparator

Comparator that can handle Hibernate proxies.

Special thanks to Tim Peeters for helping us with the implementation.


构造方法摘要
HibernateProxyComparator()
           
 
方法摘要
 boolean canCompare(Object left, Object right)
          Returns true if one or both of the objects is a Hibernate proxy.
 Difference compare(Object left, Object right, boolean onlyFirstDifference, ReflectionComparator reflectionComparator)
          Compares the given objects.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

HibernateProxyComparator

public HibernateProxyComparator()
方法详细信息

canCompare

public boolean canCompare(Object left,
                          Object right)
Returns true if one or both of the objects is a Hibernate proxy.

指定者:
接口 Comparator 中的 canCompare
参数:
left - The left object
right - The right object
返回:
True if one is a proxy

compare

public Difference compare(Object left,
                          Object right,
                          boolean onlyFirstDifference,
                          ReflectionComparator reflectionComparator)
Compares the given objects. If one of the objects is a proxy, the proxy is initialized and the wrapped values are compared. If both objects are proxies and both objects are not yet loaded (initialized) only the idendtifiers are compared. This avoids performing unnecessary loads from the database (potentially retrieving a huge amount of data). If the ids of the proxies are identical, the objects are considered identical, if not the objects are considered different.

指定者:
接口 Comparator 中的 compare
参数:
left - The left object, not null
right - The right object, not null
onlyFirstDifference - True if only the first difference should be returned
reflectionComparator - The root comparator for inner comparisons, not null
返回:
A ObjectDifference or null if both maps are equal


Copyright © 2013. All rights reserved.