Example usage for java.util Objects deepEquals

List of usage examples for java.util Objects deepEquals

Introduction

In this page you can find the example usage for java.util Objects deepEquals.

Prototype

public static boolean deepEquals(Object a, Object b) 

Source Link

Document

Returns true if the arguments are deeply equal to each other and false otherwise.

Usage

From source file:org.opendaylight.controller.cluster.datastore.DatastoreSnapshotRestoreTest.java

private static void verifySnapshot(DatastoreSnapshot expected, DatastoreSnapshot actual) {
    assertNotNull("DatastoreSnapshot is null", actual);
    assertEquals("getType", expected.getType(), actual.getType());
    assertTrue("ShardManager snapshots don't match",
            Objects.deepEquals(expected.getShardManagerSnapshot(), actual.getShardManagerSnapshot()));
    assertEquals("ShardSnapshots size", expected.getShardSnapshots().size(), actual.getShardSnapshots().size());
    for (int i = 0; i < expected.getShardSnapshots().size(); i++) {
        assertEquals("ShardSnapshot " + (i + 1) + " name", expected.getShardSnapshots().get(i).getName(),
                actual.getShardSnapshots().get(i).getName());
        assertArrayEquals("ShardSnapshot " + (i + 1) + " snapshot",
                expected.getShardSnapshots().get(i).getSnapshot(),
                actual.getShardSnapshots().get(i).getSnapshot());
    }/*from w  w w. ja v a2  s.com*/
}

From source file:com.hurence.logisland.record.Field.java

@Override
public boolean equals(Object o) {
    if (this == o)
        return true;
    if (o == null || getClass() != o.getClass())
        return false;

    Field field = (Field) o;

    if (!type.equals(field.type))
        return false;
    if (!name.equals(field.name))
        return false;
    return Objects.deepEquals(rawValue, field.rawValue);

}

From source file:org.diorite.config.serialization.BeanObject.java

@Override
public boolean equals(Object object) {
    if (this == object) {
        return true;
    }//  w  w  w .j a  va  2 s .c  o  m
    if (!(object instanceof BeanObject)) {
        return false;
    }
    BeanObject that = (BeanObject) object;
    return (this.intProperty == that.intProperty) && Objects.equals(this.stringProperty, that.stringProperty)
            && Objects.deepEquals(this.intMap.keySet().toArray(), that.intMap.keySet().toArray())
            && Objects.deepEquals(this.intMap.values().toArray(), that.intMap.values().toArray());
}

From source file:org.opentestsystem.delivery.testreg.service.impl.ExternalStudentServiceImpl.java

@Override
public StudentUpsert upsertStudent(Student student, StudentSecurity studentSecurity, String stateCode) {
    StudentUpsert studentUpsert = new StudentUpsert();
    Student existingStudent = studentService.findByStudentIdAndStateAbbreviation(student.getEntityId(),
            student.getStateAbbreviation());
    if (existingStudent != null) {
        student.setId(existingStudent.getId());
    }//from  ww w.  jav a2 s . c o  m
    // If student hasn't changed, don't save the object, just log the skip.
    if (existingStudent != null
            && Objects.deepEquals(student.toStringArray(), existingStudent.toStringArray())) {
        LOGGER.debug("Upsert SKIPPING validation/save of duplicate student " + student.getEntityId());
    } else {
        String studentErrors = validateStudent(student, studentSecurity, stateCode);
        if (!StringUtils.isEmpty(studentErrors)) {
            throw new IllegalArgumentException(studentErrors);
        }
        studentRepository.saveDomainObject(student);
    }
    studentUpsert.setInsert(existingStudent == null);
    studentUpsert.setLocation(student.getUrl());
    studentUpsert.setStudent(student);
    return studentUpsert;
}

From source file:squash.booking.lambdas.core.BookingRule.java

@Override
public boolean equals(Object obj) {
    if (obj == null) {
        return false;
    }//  w ww  .ja  v a  2  s  .c om
    if (getClass() != obj.getClass()) {
        return false;
    }
    final BookingRule other = (BookingRule) obj;

    return Objects.equals(this.booking, other.booking) && Objects.equals(this.isRecurring, other.isRecurring)
            && Objects.deepEquals(this.datesToExclude, other.datesToExclude);
}

From source file:org.dimitrovchi.conf.service.ServiceParameterUtils.java

@SuppressWarnings({ "element-type-mismatch" })
public static <P> P mergeAnnotationParameters() {
    final AnnotationParameters aParameters = annotationParameters();
    return (P) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
            aParameters.annotations.toArray(new Class[aParameters.annotations.size()]),
            new InvocationHandler() {
                @Override//w w  w  . j a va 2s.c o m
                public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                    if ("toString".equals(method.getName())) {
                        return reflectToString(aParameters.topCaller.getSimpleName(), proxy);
                    }
                    final Class<?> annotationClass = method.getDeclaringClass();
                    final List<Annotation> annotations = aParameters.annotationMap.containsKey(annotationClass)
                            ? aParameters.annotationMap.get(annotationClass)
                            : Collections.<Annotation>emptyList();
                    for (final Annotation annotation : annotations) {
                        final Object value = method.invoke(annotation, args);
                        if (!Objects.deepEquals(method.getDefaultValue(), value)) {
                            return value;
                        }
                    }
                    return method.getDefaultValue();
                }
            });
}

From source file:com.vmware.photon.controller.api.AuthInfo.java

@Override
public boolean equals(Object o) {
    if (this == o) {
        return true;
    }//from   w  ww.  j av a  2 s  . c  o m
    if (o == null || getClass() != o.getClass()) {
        return false;
    }

    AuthInfo other = (AuthInfo) o;

    return super.equals(other) && Objects.equals(this.getTenant(), other.getTenant())
            && Objects.equals(this.getUsername(), other.getUsername())
            && Objects.equals(this.getPassword(), other.getPassword())
            && Objects.deepEquals(this.getSecurityGroups(), other.getSecurityGroups());
}

From source file:com.vmware.photon.controller.api.AuthConfigurationSpec.java

@Override
public boolean equals(Object o) {
    if (this == o) {
        return true;
    }//from   w w  w.j a v a 2s.c o m
    if (o == null || getClass() != o.getClass()) {
        return false;
    }

    AuthConfigurationSpec other = (AuthConfigurationSpec) o;

    return Objects.equals(this.getEnabled(), other.getEnabled())
            && Objects.equals(this.getTenant(), other.getTenant())
            && Objects.equals(this.getPassword(), other.getPassword())
            && Objects.deepEquals(this.getSecurityGroups(), other.getSecurityGroups());
}

From source file:org.codice.ddf.configuration.admin.ImportMigrationConfigurationAdminEntry.java

private boolean propertiesMatch() {
    final Dictionary<String, Object> props = memoryConfiguration.getProperties();

    if (props == null) {
        return false;
    }// w  w w  .ja v  a 2s .c  o  m
    // remove bundle location, factory pid, and pid from the dictionary as we do not want to match
    // these
    props.remove(ConfigurationAdmin.SERVICE_FACTORYPID);
    props.remove(ConfigurationAdmin.SERVICE_BUNDLELOCATION);
    props.remove(Constants.SERVICE_PID);
    if (properties.size() != props.size()) {
        return false;
    }
    // @formatter:off - to shut up checkstyle!!!!!!!
    for (final Enumeration<String> e = properties.keys(); e.hasMoreElements();) {
        // @formatter:on
        final String key = e.nextElement();

        if (!Objects.deepEquals(properties.get(key), props.get(key))) {
            return false;
        }
    }
    return true;
}

From source file:com.vmware.photon.controller.api.model.NetworkConfiguration.java

@Override
public boolean equals(Object o) {
    if (this == o) {
        return true;
    }// w ww  .  j a va  2 s  . co  m
    if (o == null || getClass() != o.getClass()) {
        return false;
    }

    NetworkConfiguration other = (NetworkConfiguration) o;

    return Objects.equals(this.getSdnEnabled(), other.getSdnEnabled())
            && Objects.equals(this.getNetworkManagerAddress(), other.getNetworkManagerAddress())
            && Objects.equals(this.getNetworkManagerUsername(), other.getNetworkManagerUsername())
            && Objects.equals(this.getNetworkManagerPassword(), other.getNetworkManagerPassword())
            && Objects.equals(this.getNetworkZoneId(), other.getNetworkZoneId())
            && Objects.equals(this.getNetworkTopRouterId(), other.getNetworkTopRouterId())
            && Objects.equals(this.getNetworkEdgeIpPoolId(), other.getNetworkEdgeIpPoolId())
            && Objects.equals(this.getNetworkHostUplinkPnic(), other.getNetworkHostUplinkPnic())
            && Objects.equals(this.getEdgeClusterId(), other.getEdgeClusterId())
            && Objects.equals(this.getIpRange(), other.getIpRange())
            && Objects.equals(this.getFloatingIpRange(), other.getFloatingIpRange())
            && Objects.deepEquals(this.getDhcpServers(), other.getDhcpServers());
}