Package org.apache.thrift.partial
Class PartialThriftComparer<T extends TBase>
- java.lang.Object
-
- org.apache.thrift.partial.PartialThriftComparer<T>
-
public class PartialThriftComparer<T extends TBase> extends java.lang.ObjectEnables comparison of two TBase instances such that the comparison is limited to the subset of fields defined by the supplied metadata. This comparer is useful when comparing two instances where: -- one is generated by full deserialization. -- the other is generated by partial deserialization. The typical use case is to establish correctness of partial deserialization.
-
-
Constructor Summary
Constructors Constructor Description PartialThriftComparer(ThriftMetadata.ThriftStruct metadata)Constructs an instance ofPartialThriftComparer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanareEqual(T t1, T t2, java.lang.StringBuilder sb)Compares thrift objectst1andt2and returns true if they are equal false otherwise.
-
-
-
Constructor Detail
-
PartialThriftComparer
public PartialThriftComparer(ThriftMetadata.ThriftStruct metadata)
Constructs an instance ofPartialThriftComparer.- Parameters:
metadata- defines the scope of comparison.
-
-
Method Detail
-
areEqual
public boolean areEqual(T t1, T t2, java.lang.StringBuilder sb)
Compares thrift objectst1andt2and returns true if they are equal false otherwise. The comparison is limited to the scope defined bymetadata.If the objects are not equal then it optionally records their differences if
sbis supplied.- Parameters:
t1- the first object.t2- the second object.sb- if non-null, results of the comparison are returned in it.- Returns:
- true if objects are equivalent, false otherwise.
-
-