Java Object Comparison Utility Using Recursive Reflection

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

In object-oriented software, particularly in JAVA, there is no universally defined method to differentiate between two objects of the same class, limiting the ability to compare and display differences effectively.

Innovation Solution

A system and method that compares JAVA objects by using equality methods like Comparable.compareTo() or Objects.equals() to identify differences, which are then stored in an XML document, allowing for human-readable representation by recursively invoking get() methods and transforming the XML into web pages using XSL.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If JAVA equality methods (Comparable.compareTo() or Objects.equals()) are used to compare objects, then the comparison can be performed, but there is no universally defined method to determine differences between objects of the same class

Engineering Contradiction:
ImproveUniversality of comparison methodVSAvoidComparison mechanism complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The patent creates a universal comparison utility that works across all JAVA objects regardless of their specific class. The utility employs reflective programming techniques to dynamically access fields and methods of any object type, providing a single comparison mechanism that adapts to different object structures without requiring class-specific implementation details.

Inventive Principle:
Principle #6Universality (Multi-functionality)

Solution Approach 2:

The patent introduces an intermediary XML representation layer between the JAVA objects and the comparison results. Objects are first converted to XML representations, then compared, and differences are output as human-readable XML. This intermediary layer simplifies the comparison process by providing a standardized format that bridges the gap between raw JAVA objects and human-readable differences.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Loss of information

If the full Class hierarchy is described to show context of field differences, then comprehensive comparison information is provided, but the output complexity and data volume increase

Engineering Contradiction:
ImproveComparison information completenessVSAvoidOutput structure complexity
Core Design Contradiction:
Loss of informationVSDevice complexity

Solution Approach 1:

The patent segments the Class hierarchy into manageable portions by only including parent classes that are actually relevant to the comparison. Instead of always displaying the complete hierarchy, the utility dynamically determines which parent classes to include based on the objects being compared, reducing output complexity while maintaining necessary contextual information.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent applies local quality by customizing the comparison output to match the specific needs of the objects being compared. The XML representation and difference output are tailored to the actual class structure and fields of the objects, rather than using a generic fixed format. This allows comprehensive information to be provided only where relevant to the specific comparison scenario.

Inventive Principle:
Principle #3Local quality

Data Source

PatentUS7814073B2Utility for identifying differences between two Java objects
Publication Date: 2010.10.12 JPMORGAN CHASE BANK NA
  • US7814073B2 patent drawing
  • US7814073B2 patent drawing
  • US7814073B2 patent drawing

AI summary

A utility for comparing two objects in an object-oriented operating system that also records the differences so that they may be put into human-readable form. In one exemplary embodiment of this invention, two JAVA objects are compared by calling one of the equality methods. If the selected equality method indicates that there is a difference between the two objects, then get . . . ( ) methods of each object are invoked in turn. The results get . . . ( ) methods are compared. If there are differences, the differences are stored in an XML document. The get . . . ( ) method is recursively invoked until the Class of the result has no more get . . . ( ) methods to decompose.