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:com.github.robozonky.app.events.SessionEvents.java

@SuppressWarnings("unchecked")
static <T extends Event> Class<T> getImplementingEvent(final Class<T> original) {
    final Stream<Class<?>> provided = ClassUtils.getAllInterfaces(original).stream();
    final Stream<Class<?>> interfaces = original.isInterface() ? // interface could be extending it directly
            Stream.concat(Stream.of(original), provided) : provided;
    final String apiPackage = "com.github.robozonky.api.notifications";
    return (Class<T>) interfaces.filter(i -> Objects.equals(i.getPackage().getName(), apiPackage))
            .filter(i -> i.getSimpleName().endsWith("Event"))
            .filter(i -> !Objects.equals(i.getSimpleName(), "Event")).findFirst()
            .orElseThrow(() -> new IllegalStateException("Not an event:" + original));
}

From source file:com.inkubator.hrm.web.converter.ModeRefConverter.java

@Override
public String getAsString(FacesContext context, UIComponent component, Object value) {
    String message = StringUtils.EMPTY;
    // Pay Salary Component id
    String paySalaryComponentId = component.getAttributes().get("paySalaryComponentId").toString();

    try {/*from   ww  w.j  av a  2s  . com*/
        //get specifik from paysalaryComponent->modelComponent->specifik
        PaySalaryComponentService paySalaryComponentService = (PaySalaryComponentService) ServiceWebUtil
                .getService("paySalaryComponentService");
        PaySalaryComponent paySalaryComponent = paySalaryComponentService
                .getEntityByPkWithDetail(Long.valueOf(paySalaryComponentId));

        //if specific == loan schema
        if (Objects.equals(paySalaryComponent.getModelComponent().getSpesific(), HRMConstant.MODEL_COMP_LOAN)) {
            LoanNewTypeService loanSchemaService = (LoanNewTypeService) ServiceWebUtil
                    .getService("loanNewTypeService");

            LoanNewType loanNewType = loanSchemaService
                    .getEntiyByPK(Long.valueOf(paySalaryComponent.getModelReffernsil()));
            message = loanNewType.getLoanTypeName();

        }
        //if specific == reimbursment schema
        if (Objects.equals(paySalaryComponent.getModelComponent().getSpesific(),
                HRMConstant.MODEL_COMP_REIMBURSEMENT)) {
            //             
            RmbsTypeService rmbsTypeService = (RmbsTypeService) ServiceWebUtil.getService("rmbsTypeService");
            RmbsType rmbsType = rmbsTypeService
                    .getEntiyByPK(Long.valueOf(paySalaryComponent.getModelReffernsil()));
            message = rmbsType.getName();
        }
        //if specific ==benefit group
        if (Objects.equals(paySalaryComponent.getModelComponent().getSpesific(),
                HRMConstant.MODEL_COMP_BENEFIT_TABLE)) {
            BenefitGroupService benefitGroupService = (BenefitGroupService) ServiceWebUtil
                    .getService("benefitGroupService");
            BenefitGroup benefitGroup = benefitGroupService
                    .getEntiyByPK(Long.valueOf(paySalaryComponent.getModelReffernsil()));
            message = benefitGroup.getName();
        }
    } catch (Exception ex) {
        Logger.getLogger(ModelReferensiConverter.class.getName()).log(Level.SEVERE, null, ex);
    }
    return message;
}

From source file:com.connio.sdk.resource.method.MethodImpl.java

@Override
public boolean equals(Object obj) {
    if (obj == null || getClass() != obj.getClass()) {
        return false;
    }/* www. j  a  v a  2s.  c o m*/
    if (this == obj) {
        return true;
    }
    MethodImpl other = (MethodImpl) obj;
    return Objects.equals(context, other.context) && Objects.equals(funcBody, other.funcBody);
}

From source file:gr.cti.android.experimentation.model.Smartphone.java

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

    Smartphone that = (Smartphone) o;//from w  ww .  ja v  a 2  s.  co m

    if (!Objects.equals(id, that.id))
        return false;
    if (!Objects.equals(phoneId, that.phoneId))
        return false;
    return !(sensorsRules != null ? !sensorsRules.equals(that.sensorsRules) : that.sensorsRules != null);

}

From source file:th.co.geniustree.dental.model.Bill2.java

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

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

@Override
public boolean equals(java.lang.Object o) {
    if (this == o) {
        return true;
    }//from   w w  w.j a v a 2  s .co  m
    if (o == null || getClass() != o.getClass()) {
        return false;
    }
    DesignAutomationActivities designAutomationActivities = (DesignAutomationActivities) o;
    return Objects.equals(this.value, designAutomationActivities.value);
}

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

@Override
public boolean equals(java.lang.Object o) {
    if (this == o) {
        return true;
    }//www  . jav a  2s  .c  o m
    if (o == null || getClass() != o.getClass()) {
        return false;
    }
    JsonApiLinksRelated jsonApiLinksRelated = (JsonApiLinksRelated) o;
    return Objects.equals(this.related, jsonApiLinksRelated.related);
}

From source file:com.cloud.agent.api.sync.SyncNuageVspCmsIdAnswer.java

@Override
public boolean equals(Object o) {
    if (this == o) {
        return true;
    }//from   w ww  .jav  a 2  s .  c  om

    if (!(o instanceof SyncNuageVspCmsIdAnswer)) {
        return false;
    }

    SyncNuageVspCmsIdAnswer that = (SyncNuageVspCmsIdAnswer) o;

    return super.equals(that) && _success == that._success && Objects.equals(_syncType, that._syncType)
            && Objects.equals(_nuageVspCmsId, that._nuageVspCmsId);
}

From source file:com.wormsim.animals.AnimalStage2Instance.java

@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }//  w ww  . j  ava 2 s.  co m
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final AnimalStage2Instance other = (AnimalStage2Instance) obj;
    return Objects.equals(this.parent, other.parent);
}

From source file:com.linksinnovation.elearning.model.Reply.java

@Override
public boolean equals(Object obj) {
    if (obj == null) {
        return false;
    }/* w  ww .j av  a  2s .  c om*/
    if (getClass() != obj.getClass()) {
        return false;
    }
    final Reply other = (Reply) obj;
    if (!Objects.equals(this.id, other.id)) {
        return false;
    }
    return true;
}