List of usage examples for org.apache.commons.lang ObjectUtils equals
public static boolean equals(Object object1, Object object2)
Compares two objects for equality, where either one or both objects may be null
.
ObjectUtils.equals(null, null) = true ObjectUtils.equals(null, "") = false ObjectUtils.equals("", null) = false ObjectUtils.equals("", "") = true ObjectUtils.equals(Boolean.TRUE, null) = false ObjectUtils.equals(Boolean.TRUE, "true") = false ObjectUtils.equals(Boolean.TRUE, Boolean.TRUE) = true ObjectUtils.equals(Boolean.TRUE, Boolean.FALSE) = false
From source file:com.opengamma.analytics.financial.equity.future.derivative.CashSettledFuture.java
@Override public boolean equals(final Object obj) { if (this == obj) { return true; }/*from w w w.j a v a 2 s . c o m*/ if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final CashSettledFuture other = (CashSettledFuture) obj; if (!ObjectUtils.equals(_currency, other._currency)) { return false; } if (Double.doubleToLongBits(_unitAmount) != Double.doubleToLongBits(other._unitAmount)) { return false; } if (Double.doubleToLongBits(_referencePrice) != Double.doubleToLongBits(other._referencePrice)) { return false; } if (Double.doubleToLongBits(_timeToSettlement) != Double.doubleToLongBits(other._timeToSettlement)) { return false; } if (Double.doubleToLongBits(_timeToExpiry) != Double.doubleToLongBits(other._timeToExpiry)) { return false; } return true; }
From source file:com.aurel.track.persist.BaseTGeneralSettings.java
/** * Set the value of Config//from w w w. j a v a2 s .c o m * * @param v new value */ public void setConfig(Integer v) throws TorqueException { if (!ObjectUtils.equals(this.config, v)) { this.config = v; setModified(true); } if (aTFieldConfig != null && !ObjectUtils.equals(aTFieldConfig.getObjectID(), v)) { aTFieldConfig = null; } }
From source file:com.opengamma.engine.view.client.ViewDeltaResultCalculator.java
private static void computeDeltaModel(DeltaDefinition deltaDefinition, InMemoryViewDeltaResultModel deltaModel, ComputationTargetSpecification targetSpec, String calcConfigName, ViewCalculationResultModel previousCalcModel, ViewCalculationResultModel resultCalcModel) { final Map<Pair<String, ValueProperties>, ComputedValueResult> resultValues = resultCalcModel .getValues(targetSpec);// ww w . ja v a2 s . c om if (resultValues != null) { if (previousCalcModel == null) { // Everything is new/delta because this is a new calculation context. for (Map.Entry<Pair<String, ValueProperties>, ComputedValueResult> resultEntry : resultValues .entrySet()) { deltaModel.addValue(calcConfigName, resultEntry.getValue()); } } else { final Map<Pair<String, ValueProperties>, ComputedValueResult> previousValues = previousCalcModel .getValues(targetSpec); if (previousValues == null) { // Everything is new/delta because this is a new target. for (ComputedValueResult result : resultValues.values()) { deltaModel.addValue(calcConfigName, result); } } else { // Have to individual delta. for (Map.Entry<Pair<String, ValueProperties>, ComputedValueResult> resultEntry : resultValues .entrySet()) { ComputedValueResult resultValue = resultEntry.getValue(); ComputedValueResult previousValue = previousValues.get(resultEntry.getKey()); // REVIEW jonathan 2010-05-07 -- The previous value that we're comparing with is the value from the last // computation cycle, not the value that we last emitted as a delta. It is therefore important that the // DeltaComparers take this into account in their implementation of isDelta. E.g. they should compare the // values after truncation to the required decimal place, rather than testing whether the difference of the // full values is greater than some threshold; this way, there will always be a point beyond which a change // is detected, even in the event of gradual creep. if (deltaDefinition.isDelta(previousValue, resultValue) || !ObjectUtils.equals(previousValue.getAggregatedExecutionLog(), resultValue.getAggregatedExecutionLog())) { deltaModel.addValue(calcConfigName, resultEntry.getValue()); } } } } } }
From source file:dz.alkhwarizmix.framework.java.dtos.extend.model.vo.AbstractAlKhwarizmixDomainObjectExtendableWithSecurity.java
@Override public boolean equals(final Object other) { final boolean result = super.equals(other) && (getObjectAsThisClass(other) != null) && ObjectUtils.equals(group, getObjectAsThisClass(other).group) && ObjectUtils.equals(owner, getObjectAsThisClass(other).owner) && ObjectUtils.equals(encryption, getObjectAsThisClass(other).encryption); return result; }
From source file:com.vaadin.addon.jpacontainer.demo.domain.Invoice.java
@Override public boolean equals(Object obj) { if (obj.getClass() == getClass()) { Invoice o = (Invoice) obj;/*from w w w . ja v a2s. com*/ return ObjectUtils.equals(invoiceNo, o.invoiceNo) && DateUtils.isSameDayOrNull(invoiceDate, o.invoiceDate) && ObjectUtils.equals(order, o.order) && DateUtils.isSameDayOrNull(dueDate, o.dueDate) && DateUtils.isSameDayOrNull(paidDate, o.paidDate) && ObjectUtils.equals(items, o.items); } return false; }
From source file:com.opengamma.analytics.financial.model.option.pricing.fourier.EuropeanPriceIntegrand.java
@Override public boolean equals(final Object obj) { if (this == obj) { return true; }//from w w w . j ava2s . c o m if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final EuropeanPriceIntegrand other = (EuropeanPriceIntegrand) obj; if (Double.doubleToLongBits(_alpha) != Double.doubleToLongBits(other._alpha)) { return false; } if (!ObjectUtils.equals(_ce, other._ce)) { return false; } return _useVarianceReduction == other._useVarianceReduction; }
From source file:com.aurel.track.persist.BaseTEscalationState.java
/** * Set the value of Status/*from ww w.ja va 2 s. c om*/ * * @param v new value */ public void setStatus(Integer v) throws TorqueException { if (!ObjectUtils.equals(this.status, v)) { this.status = v; setModified(true); } if (aTState != null && !ObjectUtils.equals(aTState.getObjectID(), v)) { aTState = null; } }
From source file:com.aurel.track.persist.BaseTRecurrencePattern.java
/** * Set the value of ObjectID/* ww w .ja v a2 s .co m*/ * * @param v new value */ public void setObjectID(Integer v) throws TorqueException { if (!ObjectUtils.equals(this.objectID, v)) { this.objectID = v; setModified(true); } // update associated TReportSubscribe if (collTReportSubscribes != null) { for (int i = 0; i < collTReportSubscribes.size(); i++) { ((TReportSubscribe) collTReportSubscribes.get(i)).setRecurrencePattern(v); } } }
From source file:com.aurel.track.persist.BaseTDepartment.java
/** * Set the value of ObjectID/* w w w . j a v a2 s. c o m*/ * * @param v new value */ public void setObjectID(Integer v) throws TorqueException { if (!ObjectUtils.equals(this.objectID, v)) { this.objectID = v; setModified(true); } // update associated TPerson if (collTPersons != null) { for (int i = 0; i < collTPersons.size(); i++) { ((TPerson) collTPersons.get(i)).setDepartmentID(v); } } // update associated TOrgProjectSLA if (collTOrgProjectSLAs != null) { for (int i = 0; i < collTOrgProjectSLAs.size(); i++) { ((TOrgProjectSLA) collTOrgProjectSLAs.get(i)).setDepartment(v); } } }
From source file:ca.sqlpower.wabit.report.selectors.ComboBoxSelector.java
public void setStaticValues(String staticValues) { String oldStaticValues = this.staticValues; this.staticValues = staticValues; if (!ObjectUtils.equals(this.staticValues, oldStaticValues)) { Collection<Object> values = getPossibleValues(); if (values.size() > 0) { this.setSelectedValue(values.iterator().next()); } else {//from w w w. java 2 s . com this.setSelectedValue(null); } firePropertyChange("staticValues", oldStaticValues, this.staticValues); } }