Example usage for java.util Objects equals

List of usage examples for java.util Objects equals

Introduction

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

Prototype

public static boolean equals(Object a, Object b) 

Source Link

Document

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

Usage

From source file:info.glennengstrand.api.Outbound.java

@Override
public boolean equals(java.lang.Object o) {
    if (this == o) {
        return true;
    }/* w  w  w.  java  2  s . c  o  m*/
    if (o == null || getClass() != o.getClass()) {
        return false;
    }
    Outbound outbound = (Outbound) o;
    return Objects.equals(this.from, outbound.from) && Objects.equals(this.occurred, outbound.occurred)
            && Objects.equals(this.subject, outbound.subject) && Objects.equals(this.story, outbound.story);
}

From source file:de.metas.procurement.webui.sync.SyncProductImportService.java

/**
 * Imports the given <code>syncProduct</code>, updating the given <code>product</code> if feasible.
 * If it's not feasible, then the method attempts to load the {@link Product} to update using the given <code>syncProduct</code>'s UUID.<br>
 * If there is no such existing product, the method creates a new one.
 *
 * @param syncProduct/*from w ww. ja  v  a2 s.  c  o  m*/
 * @param product the product to be updated. If <code>null</code> or if its UUID doesn't match the given <code>syncProduct</code>'s UUID, then this parameter is ignored.
 * @return
 */
public Product importProduct(final SyncProduct syncProduct, Product product) {
    final String uuid = syncProduct.getUuid();
    if (product != null && !Objects.equals(product.getUuid(), uuid)) {
        product = null;
    }
    if (product == null) {
        product = productsRepo.findByUuid(uuid);
    }

    //
    // Handle delete request
    if (syncProduct.isDeleted()) {
        if (product == null) {
            // does not exist anyways
            return null;
        } else {
            deleteProduct(product);
            return null;
        }
    }

    if (product == null) {
        product = new Product();
        product.setUuid(uuid);
    }

    product.setDeleted(false);
    product.setName(syncProduct.getName());
    product.setPackingInfo(syncProduct.getPackingInfo());
    product.setShared(syncProduct.isShared());
    productsRepo.save(product);
    logger.debug("Imported: {} -> {}", syncProduct, product);

    //
    // Import product translations
    final Map<String, ProductTrl> productTrls = mapByLanguage(productTrlsRepo.findByRecord(product));
    for (final Map.Entry<String, String> lang2nameTrl : syncProduct.getNamesTrl().entrySet()) {
        final String language = lang2nameTrl.getKey();
        final String nameTrl = lang2nameTrl.getValue();

        ProductTrl productTrl = productTrls.remove(language);
        if (productTrl == null) {
            productTrl = new ProductTrl();
            productTrl.setLanguage(language);
            productTrl.setRecord(product);
        }

        productTrl.setName(nameTrl);
        productTrlsRepo.save(productTrl);
        logger.debug("Imported: {}", productTrl);
    }
    for (final ProductTrl productTrl : productTrls.values()) {
        productTrlsRepo.delete(productTrl);
    }

    return product;
}

From source file:com.davidbracewell.math.distribution.Multinomial.java

@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }/*from  ww  w.j  a v  a2s.  c  o m*/
    if (obj == null || getClass() != obj.getClass()) {
        return false;
    }
    final Multinomial other = (Multinomial) obj;
    return Objects.equals(this.probabilities, other.probabilities)
            && Objects.equals(this.defaultProbability, other.defaultProbability);
}

From source file:com.torchmind.upm.bundle.BasicCoordinate.java

/**
 * {@inheritDoc}//from   w w w .  j  av a  2s  . com
 */
@Override
public boolean equals(Object o) {
    if (this == o)
        return true;
    if (o == null || getClass() != o.getClass())
        return false;
    BasicCoordinate that = (BasicCoordinate) o;
    return Objects.equals(this.groupId, that.groupId) && Objects.equals(this.bundleId, that.bundleId)
            && Objects.equals(this.type, that.type) && Objects.equals(this.version, that.version);
}

From source file:com.vsct.dt.hesperides.indexation.model.TemplateIndexation.java

@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }//from   w  ww . j a va  2s . c  o  m
    if (obj == null || getClass() != obj.getClass()) {
        return false;
    }
    final TemplateIndexation other = (TemplateIndexation) obj;
    return Objects.equals(this.name, other.name) && Objects.equals(this.namespace, other.namespace)
            && Objects.equals(this.filename, other.filename) && Objects.equals(this.location, other.location);
}

From source file:org.thevortex.lighting.jinks.groups.Group.java

@Override
public boolean stateChanged(Group other) {
    boolean same = super.stateChanged(other) && Objects.equals(readingAggregation, other.readingAggregation)
            && Objects.equals(automationMode, other.automationMode);
    return !same;
}

From source file:com.autodesk.client.model.JobPayload.java

@Override
public boolean equals(java.lang.Object o) {
    if (this == o) {
        return true;
    }//from  w  w w  .j  a v a2 s.c  o  m
    if (o == null || getClass() != o.getClass()) {
        return false;
    }
    JobPayload jobPayload = (JobPayload) o;
    return Objects.equals(this.input, jobPayload.input) && Objects.equals(this.output, jobPayload.output);
}

From source file:org.basinmc.maven.plugins.minecraft.launcher.VersionDescriptor.java

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

    VersionDescriptor that = (VersionDescriptor) o;
    return Objects.equals(this.id, that.id) && this.type == that.type;
}

From source file:com.autodesk.client.model.MetadataMetadata.java

@Override
public boolean equals(java.lang.Object o) {
    if (this == o) {
        return true;
    }/*from   w  w  w .  ja  v  a 2 s. c o m*/
    if (o == null || getClass() != o.getClass()) {
        return false;
    }
    MetadataMetadata metadataMetadata = (MetadataMetadata) o;
    return Objects.equals(this.name, metadataMetadata.name) && Objects.equals(this.guid, metadataMetadata.guid);
}

From source file:com.vsct.dt.strowgr.admin.nsq.payload.fragment.Header.java

@Override
public boolean equals(Object o) {
    if (this == o)
        return true;
    if (o == null || getClass() != o.getClass())
        return false;
    Header header = (Header) o;//from  w  w w.  j a v  a2 s  . c  om
    return Objects.equals(correlationId, header.correlationId)
            && Objects.equals(application, header.application) && Objects.equals(platform, header.platform)
            && Objects.equals(timestamp, header.timestamp) && Objects.equals(source, header.source);
}