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.xebialabs.aphillips.usertype.examples.take1.ReadableStringBuilderUserType.java
@Override public boolean equals(Object x, Object y) throws HibernateException { return ObjectUtils.equals(x, y); }
From source file:com.haulmont.cuba.web.gui.components.WebSearchPickerField.java
protected void initValueSync(final ComboBox selectComponent, final WebPickerField.Picker picker) { selectComponent.addValueChangeListener(new Property.ValueChangeListener() { @Override/*from w ww. j a v a 2s .co m*/ public void valueChange(Property.ValueChangeEvent event) { if (updateComponentValue) return; updateComponentValue = true; if (!ObjectUtils.equals(selectComponent.getValue(), picker.getValue())) { //noinspection unchecked picker.setValueIgnoreReadOnly(selectComponent.getValue()); } updateComponentValue = false; } }); picker.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (updateComponentValue) return; updateComponentValue = true; if (!ObjectUtils.equals(selectComponent.getValue(), picker.getValue())) { selectComponent.setValueIgnoreReadOnly(picker.getValue()); } updateComponentValue = false; } }); }
From source file:de.fu_berlin.inf.dpp.activities.business.TextSelectionActivity.java
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (!(obj instanceof TextSelectionActivity)) return false; TextSelectionActivity activity = (TextSelectionActivity) obj; return (this.offset == activity.offset) && (this.length == activity.length) && (ObjectUtils.equals(this.path, activity.path)); }
From source file:com.opengamma.analytics.financial.instrument.payment.CouponFloatingDefinition.java
@Override public boolean equals(final Object obj) { if (this == obj) { return true; }// ww w .j a v a2 s .com if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } final CouponFloatingDefinition other = (CouponFloatingDefinition) obj; return ObjectUtils.equals(_fixingDate, other._fixingDate); }
From source file:com.haulmont.yarg.formatters.impl.doc.connector.WinProcessManager.java
@Override @SuppressWarnings("unchecked") public List<Long> findPid(String host, int port) { try {//w w w .j a v a 2s . co m if ("localhost".equalsIgnoreCase(host)) host = LOCAL_HOST; Process process = Runtime.getRuntime().exec(String.format(FIND_PID_COMMAND, port)); List r = IOUtils.readLines(process.getInputStream()); for (Object output : r) { NetStatInfo info = new NetStatInfo((String) output); if (info.localPort == port && ObjectUtils.equals(host, info.localAddress)) return Collections.singletonList(info.pid); } } catch (IOException e) { log.warn(String.format("Unable to find PID for OO process on host:port %s:%s", host, port), e); } log.warn(String.format("Unable to find PID for OO process on host:port %s:%s", host, port)); return Collections.singletonList(PID_UNKNOWN); }
From source file:com.opengamma.analytics.math.cube.Cube.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 Cube<?, ?, ?, ?> other = (Cube<?, ?, ?, ?>) obj; return ObjectUtils.equals(_name, other._name); }
From source file:com.github.lukaszkusek.xml.comparator.XMLComparator.java
XMLDiff compare() throws TransformerException, IOException { Node rootNode1 = xmlDocument1.getRootNode(); Node rootNode2 = xmlDocument2.getRootNode(); DifferenceDetails differenceDetails; if (ObjectUtils.equals(rootNode1.getXPath(), rootNode2.getXPath())) { differenceDetails = compare(rootNode1, rootNode2); } else {/*from w ww . jav a2s .c o m*/ differenceDetails = DifferenceDetails.of(rootNode1, rootNode2, DifferenceCode.DIFFERENT_ROOT_NODE); } return new XMLDiff(xmlDocument1, xmlDocument2, differenceDetails.filter(xPathsToOmitPredicate)); }
From source file:gov.nih.nci.cabig.caaers.validation.annotation.UniqueIdentifierForParticipantValidator.java
/** * Will check in the DB whether there exist another participant with the same ID. *//*from w ww. j a v a 2s. co m*/ public boolean validate(final Object value) { // is value null ? if (value == null) return true; // is value not an Identifier instance ? if (!(value instanceof Identifier)) return true; Identifier other = (Identifier) value; ParticipantQuery participantQuery = new ParticipantQuery(); participantQuery.leftJoinFetchOnIdentifiers(); if (other.getValue() != null) participantQuery.filterByIdentifierValueExactMatch(other.getValue()); if (other.getType() != null) participantQuery.filterByIdentifierTypeExactMatch(other.getType()); List<Participant> participants = participantDao.searchParticipant(participantQuery); // there exist another participant with the same identifier ?. if (participants == null || participants.size() <= 0) { return true; } for (Participant p : participants) { for (Identifier identifier : p.getIdentifiers()) { if (StringUtils.equals(other.getValue(), identifier.getValue()) && StringUtils.equals(other.getType(), identifier.getType()) && !ObjectUtils.equals(other.getId(), identifier.getId())) return false; } } return true; }
From source file:com.opengamma.analytics.financial.model.option.parameters.BlackFlatCapFloorParameters.java
@Override public boolean equals(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; } BlackFlatCapFloorParameters other = (BlackFlatCapFloorParameters) obj; if (!ObjectUtils.equals(_index, other._index)) { return false; } if (!ObjectUtils.equals(_volatility, other._volatility)) { return false; } return true; }
From source file:com.opengamma.engine.calcnode.Capability.java
@Override public boolean equals(final Object o) { if (o == this) { return true; }/*from w w w. j a v a 2 s .c o m*/ if (!(o instanceof Capability)) { return false; } final Capability other = (Capability) o; return ObjectUtils.equals(getIdentifier(), other.getIdentifier()) && ObjectUtils.equals(getLowerBoundParameter(), other.getLowerBoundParameter()) && ObjectUtils.equals(getUpperBoundParameter(), other.getUpperBoundParameter()); }