Java tutorial
//package com.java2s; //License from project: Apache License import java.lang.reflect.Field; public class Main { private static boolean equalFields(Object paramObject1, Object paramObject2) { boolean bool1 = false; Field[] arrayOfField1 = paramObject1.getClass().getDeclaredFields(); Field[] arrayOfField2 = paramObject2.getClass().getDeclaredFields(); if (arrayOfField1.length != arrayOfField2.length) { return bool1; } int i = 0; try { while (true) { if (i >= arrayOfField1.length) break; Field localField1 = arrayOfField1[i]; localField1.setAccessible(true); Field localField2 = arrayOfField2[i]; localField2.setAccessible(true); Object localObject1 = localField1.get(paramObject1); Object localObject2 = localField2.get(paramObject2); if ((localObject1 == null) && (localObject2 != null)) break; if (localObject1 != null) { boolean bool2 = localObject1.equals(localObject2); if (!bool2) break; } i++; } } catch (IllegalArgumentException localIllegalArgumentException) { localIllegalArgumentException.printStackTrace(); bool1 = true; } catch (IllegalAccessException localIllegalAccessException) { label122: localIllegalAccessException.printStackTrace(); } return bool1; } }