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.sensitivity.PositionGreek.java
@Override public boolean equals(final Object obj) { if (this == obj) { return true; }// ww w . j a v a 2 s .co m if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final PositionGreek other = (PositionGreek) obj; return ObjectUtils.equals(_underlyingGreek, other._underlyingGreek); }
From source file:com.tesora.dve.sql.util.ColumnChecker.java
protected String equalObjects(Object expected, Object actual) { if (ObjectUtils.equals(expected, actual)) return null; String typeExpected = ""; String typeActual = ""; if (expected.getClass() != actual.getClass()) { typeExpected = " [" + expected.getClass().toString() + "]"; typeActual = " [" + actual.getClass().toString() + "]"; }/*from www . ja v a 2s. c o m*/ return "Expected: '" + asString(expected) + "'" + typeExpected + "; Actual: '" + asString(actual) + "'" + typeActual; }
From source file:com.opengamma.financial.analytics.model.volatility.surface.fitted.SurfaceFittedSmileDataPoints.java
@Override public boolean equals(final Object obj) { if (this == obj) { return true; }//from w w w . java 2 s .c om if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final SurfaceFittedSmileDataPoints other = (SurfaceFittedSmileDataPoints) obj; return ObjectUtils.equals(_data, other._data); }
From source file:com.opengamma.core.FudgeUniqueIdResolutionTools.java
public static void appendNewVersion(MutableFudgeMsg message, FudgeContext fudgeContext, UniqueId newVersion, Instant effectiveInstantFrom, Instant effectiveInstantTo, Instant correctionInstantFrom, Instant correctionInstantTo) { // First, modify the previous version if required. // Can be changed to be index based for performance if necessary. List<FudgeField> fields = message.getAllFields(); fields = Lists.reverse(fields);// w w w . j av a 2 s. c om boolean foundMatchingOid = false; boolean mutatedOlderOid = false; for (FudgeField field : fields) { MutableFudgeMsg record = (MutableFudgeMsg) field.getValue(); UniqueId recordId = UniqueId.parse(record.getString("uid")); if (!recordId.getObjectId().equals(newVersion.getObjectId())) { // No need to modify. continue; } foundMatchingOid = true; Instant recordEffectiveFrom = record.getFieldValue(Instant.class, record.getByName("eff-from")); Instant recordEffectiveTo = record.getFieldValue(Instant.class, record.getByName("eff-to")); //Instant recordCorrectionFrom = record.getFieldValue(Instant.class, record.getByName("cor-from")); Instant recordCorrectionTo = record.getFieldValue(Instant.class, record.getByName("cor-to")); if (ObjectUtils.equals(recordEffectiveFrom, effectiveInstantFrom)) { // The two EffectiveTo better match as well. ArgumentChecker.isTrue(ObjectUtils.equals(recordEffectiveTo, effectiveInstantTo), "Record matches effectiveFrom but not effectiveTo."); // Must be a new version on the correction. if (recordCorrectionTo != null) { continue; } record.remove("cor-to"); record.add("cor-to", correctionInstantFrom); mutatedOlderOid = true; } else if (recordEffectiveFrom.isBefore(effectiveInstantFrom) && (recordEffectiveTo == null)) { record.add("eff-to", effectiveInstantFrom); mutatedOlderOid = true; } } if (foundMatchingOid && !mutatedOlderOid) { throw new OpenGammaRuntimeException("Algorithm failure: found existing OID but did not mutate any."); } MutableFudgeMsg record = fudgeContext.newMessage(); record.add("uid", newVersion.toString()); record.add("eff-from", effectiveInstantFrom); if (effectiveInstantTo != null) { record.add("eff-to", effectiveInstantTo); } record.add("corr-from", correctionInstantFrom); if (effectiveInstantTo != null) { record.add("corr-to", correctionInstantTo); } message.add(0, record); }
From source file:com.eyeq.pivot4j.util.OlapUtils.java
/** * @param elem/* w ww. ja v a 2s. co m*/ * @param otherElem * @return */ public static boolean equals(MetadataElement elem, MetadataElement otherElem) { if (elem == null) { return otherElem == null; } else if (otherElem == null) { return false; } String uniqueName = elem.getUniqueName(); String otherUniqueName = otherElem.getUniqueName(); return ObjectUtils.equals(uniqueName, otherUniqueName); }
From source file:de.codesourcery.eve.skills.db.datamodel.Corporation.java
@Override public boolean equals(Object obj) { return (obj instanceof Corporation) && ObjectUtils.equals(((Corporation) obj).getId(), this.id); }
From source file:com.haulmont.cuba.core.sys.QueryHolder.java
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; QueryHolder that = (QueryHolder) o;/*from ww w. ja va2 s . c o m*/ if (query == null || that.query == null) return false; if (!ObjectUtils.equals(query.getQueryString(), that.query.getQueryString())) return false; if (!ObjectUtils.equals(query.getParameters(), that.query.getParameters())) return false; return true; }
From source file:com.haulmont.cuba.gui.data.impl.testmodel1.TestMasterEntity.java
public void setMasterName(String masterName) { String o = this.masterName; this.masterName = masterName; if (!ObjectUtils.equals(o, masterName)) propertyChanged("masterName", o, masterName); }
From source file:net.meteor.exception.NoSuchBeanDefinitionException.java
@Override public boolean equals(Object other) { if (this == other) { return true; }// w w w .ja v a 2s. c om if (!(other instanceof NoSuchBeanDefinitionException)) { return false; } NoSuchBeanDefinitionException otherBe = (NoSuchBeanDefinitionException) other; return (getMessage().equals(otherBe.getMessage()) && ObjectUtils.equals(getCause(), otherBe.getCause())); }
From source file:com.opengamma.analytics.financial.model.volatility.surface.DriftSurface.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 DriftSurface other = (DriftSurface) obj; return ObjectUtils.equals(_surface, other._surface); }