private static void lookForChanges(DataObject left,DataObject right,HashMap<String,Change> changes,Set<String> included,Set<String> excluded,Set<String> contained){
  Class refClass=left.getClass();
  Method[] methods=refClass.getMethods();
  for (  Method method : methods) {
    boolean contain=false;
    Name nameAnn=method.getAnnotation(Name.class);
    if (nameAnn == null) {
      continue;
    }
    String key=nameAnn.value();
    if (contained != null && contained.contains(key)) {
      contain=true;
    }
 else     if (included != null && !included.contains(key)) {
      continue;
    }
    if (excluded.contains(key)) {
      continue;
    }
    Class type=method.getReturnType();
    try {
      Object obja=method.invoke(left);
      Object objb=method.invoke(right);
      if (type == StringSet.class) {
        if (contain) {
          analyzeNewStringSetContainsOldStringSetValues((StringSet)obja,(StringSet)objb,key,changes);
        }
 else {
          analyzeStringSets((StringSet)obja,(StringSet)objb,key,changes);
        }
      }
 else       if (type == StringMap.class) {
        analyzeStringMaps((StringMap)obja,(StringMap)objb,key,changes);
      }
 else       if (type == StringSetMap.class) {
        analyzeStringSetMaps((StringSetMap)obja,(StringSetMap)objb,key,changes);
      }
 else {
        if (!isEqual(obja,objb)) {
          Change change=new Change(key,obja,objb,nameAnn.value());
          changes.put(key,change);
        }
      }
    }
 catch (    IllegalAccessException ex) {
      throw new ServiceCodeException(ServiceCode.UNFORSEEN_ERROR,ex,ex.getMessage(),new String[]{});
    }
catch (    InvocationTargetException ex) {
      throw new ServiceCodeException(ServiceCode.UNFORSEEN_ERROR,ex,ex.getMessage(),new String[]{});
    }
  }
}

private static void lookForChanges ( DataObject left , DataObject right , HashMap < String , Change > changes , Set < String > included , Set < String > excluded , Set < String > contained ) { Class refClass = left . getClass ( ) ; Method [ ] methods = refClass . getMethods ( ) ; for ( Method method : methods ) { boolean contain = false ; Name nameAnn = method . getAnnotation ( Name . class ) ; if ( nameAnn == null ) { continue ; } String key = nameAnn . value ( ) ; if ( contained != null && contained . contains ( key ) ) { contain = true ; } else if ( included != null && ! included . contains ( key ) ) { continue ; } if ( excluded . contains ( key ) ) { continue ; } Class type = method . getReturnType ( ) ; try { Object obja = method . invoke ( left ) ; Object objb = method . invoke ( right ) ; if ( type == StringSet . class ) { if ( contain ) { analyzeNewStringSetContainsOldStringSetValues ( ( StringSet ) obja , ( StringSet ) objb , key , changes ) ; } else { analyzeStringSets ( ( StringSet ) obja , ( StringSet ) objb , key , changes ) ; } } else if ( type == StringMap . class ) { analyzeStringMaps ( ( StringMap ) obja , ( StringMap ) objb , key , changes ) ; } else if ( type == StringSetMap . class ) { analyzeStringSetMaps ( ( StringSetMap ) obja , ( StringSetMap ) objb , key , changes ) ; } else { if ( ! isEqual ( obja , objb ) ) { Change change = new Change ( key , obja , objb , nameAnn . value ( ) ) ; changes . put ( key , change ) ; } } } catch ( IllegalAccessException ex ) { throw new ServiceCodeException ( ServiceCode . UNFORSEEN_ERROR , ex , ex . getMessage ( ) , new String [ ] { } ) ; } catch ( InvocationTargetException ex ) { throw new ServiceCodeException ( ServiceCode . UNFORSEEN_ERROR , ex , ex . getMessage ( ) , new String [ ] { } ) ; } } }
scans the methods looking for ones annotated with the name annotation . when found ( if not excluded ) , invokes the method on each of the dataobjects and then compares the results .
