public boolean equals()

in geode-junit/src/main/java/org/apache/geode/pdx/TestObjectForJSONFormatter.java [876:1024]


  public boolean equals(Object obj) {
    if (this == obj) {
      return true;
    }
    if (obj == null) {
      return false;
    }
    if (getClass() != obj.getClass()) {
      return false;
    }

    TestObjectForJSONFormatter other = (TestObjectForJSONFormatter) obj;

    // primitive type
    if (p_bool != other.p_bool) {
      return false;
    }
    if (p_byte != other.p_byte) {
      return false;
    }
    if (p_short != other.p_short) {
      return false;
    }
    if (p_int != other.p_int) {
      return false;
    }
    if (p_long != other.p_long) {
      return false;
    }
    if (p_float != other.p_float) {
      return false;
    }
    if (p_double != other.p_double) {
      return false;
    }

    // wrapper type
    if (w_bool.booleanValue() != other.w_bool.booleanValue()) {
      return false;
    }
    if (w_byte.byteValue() != other.w_byte.byteValue()) {
      return false;
    }
    if (w_short.shortValue() != other.w_short.shortValue()) {
      return false;
    }
    if (w_int.intValue() != other.w_int.intValue()) {
      return false;
    }
    if (w_long.longValue() != other.w_long.longValue()) {
      return false;
    }
    if (w_float.floatValue() != other.w_float.floatValue()) {
      return false;
    }
    if (w_double.doubleValue() != other.w_double.doubleValue()) {
      return false;
    }
    if (!w_string.equals(other.w_string)) {
      return false;
    }
    if (w_bigInt.longValue() != other.w_bigInt.longValue()) {
      return false;
    }
    if (w_bigDec.longValue() != other.w_bigDec.longValue()) {
      return false;
    }

    // Primitive arrays
    if (!Arrays.equals(p_boolArray, other.p_boolArray)) {
      return false;
    }
    if (!Arrays.equals(p_byteArray, other.p_byteArray)) {
      return false;
    }
    if (!Arrays.equals(p_shortArray, other.p_shortArray)) {
      return false;
    }
    if (!Arrays.equals(p_intArray, other.p_intArray)) {
      return false;
    }
    if (!Arrays.equals(p_longArray, other.p_longArray)) {
      return false;
    }
    if (!Arrays.equals(p_floatArray, other.p_floatArray)) {
      return false;
    }
    if (!Arrays.equals(p_doubleArray, other.p_doubleArray)) {
      return false;
    }

    // wrapper Arrays
    if (!Arrays.equals(w_boolArray, other.w_boolArray)) {
      return false;
    }
    if (!Arrays.equals(w_byteArray, other.w_byteArray)) {
      return false;
    }
    if (!Arrays.equals(w_shortArray, other.w_shortArray)) {
      return false;
    }
    if (!Arrays.equals(w_intArray, other.w_intArray)) {
      return false;
    }
    if (!Arrays.equals(w_longArray, other.w_longArray)) {
      return false;
    }
    if (!Arrays.equals(w_floatArray, other.w_floatArray)) {
      return false;
    }
    if (!Arrays.equals(w_doubleArray, other.w_doubleArray)) {
      return false;
    }
    if (!Arrays.equals(w_strArray, other.w_strArray)) {
      return false;
    }
    if (!Arrays.equals(w_bigIntArray, other.w_bigIntArray)) {
      return false;
    }
    if (!Arrays.equals(w_bigDecArray, other.w_bigDecArray)) {
      return false;
    }

    // comparing Collections based on content, order not considered
    if (!(c_list.size() == other.c_list.size() && c_list.containsAll(other.c_list)
        && other.c_list.containsAll(c_list))) {
      return false;
    }
    if (!(c_set.size() == other.c_set.size() && c_set.containsAll(other.c_set)
        && other.c_set.containsAll(c_set))) {
      return false;
    }
    if (!(c_queue.size() == other.c_queue.size() && c_queue.containsAll(other.c_queue)
        && other.c_queue.containsAll(c_queue))) {
      return false;
    }
    if (!(c_deque.size() == other.c_deque.size() && c_deque.containsAll(other.c_deque)
        && other.c_deque.containsAll(c_deque))) {
      return false;
    }

    // map comparision.
    if (!(compareMaps(m_empByCity, other.m_empByCity))) {
      return false;
    }

    // Enum validation
    return day.equals(other.day);
  }