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:at.porscheinformatik.common.spring.web.extended.util.LocaleUtils.java
public static Locale closestSupportedLocale(List<Locale> supportedLocales, Locale locale) { if (locale == null || supportedLocales == null) { return null; }/*from www . j av a 2 s. co m*/ Locale closest = null; int closestMatches = 0; for (Locale l : supportedLocales) { int matches = 0; // If the language does not match no more processing is needed if (ObjectUtils.equals(l.getLanguage(), locale.getLanguage())) { matches++; // if the country does not match no more processing is needed if (ObjectUtils.equals(l.getCountry(), locale.getCountry())) { matches++; if (ObjectUtils.equals(l.getVariant(), locale.getVariant())) { matches++; } } } /* * If language, country and variant match, we have our locale and no * more iteration is needed */ if (matches == 3) { return l; } if (matches > closestMatches) { closestMatches = matches; closest = l; } } return closest; }
From source file:com.haulmont.cuba.security.entity.PermissionType.java
/** Constructs type from corresponding database value */ public static PermissionType fromId(Integer id) { for (PermissionType type : PermissionType.values()) { if (ObjectUtils.equals(type.getId(), id)) { return type; }/* www . j a v a 2 s . co m*/ } return null; }
From source file:mitm.common.postfix.PostfixQueueStatus.java
public static PostfixQueueStatus fromString(String s) { for (PostfixQueueStatus status : PostfixQueueStatus.values()) { if (ObjectUtils.equals(s, status.status)) { return status; }//from w w w .j a v a2s . c o m } return DEFERRED; }
From source file:com.mirth.connect.model.QueuedMessage.java
public boolean equals(Object that) { if (this == that) { return true; }/*from w ww . j av a 2 s . c om*/ if (!(that instanceof QueuedMessage)) { return false; } QueuedMessage queuedMessage = (QueuedMessage) that; return ObjectUtils.equals(this.getEndpointUri(), queuedMessage.getEndpointUri()) && ObjectUtils.equals(this.getMessageObject(), queuedMessage.getMessageObject()); }
From source file:com.eyeq.pivot4j.ui.command.AbstractDrillDownCommand.java
/** * @see com.eyeq.pivot4j.ui.command.CellCommand#canExecute(com.eyeq.pivot4j.ui * .RenderContext)//from ww w .ja v a2 s. c o m */ @Override public boolean canExecute(RenderContext context) { boolean enabled = ObjectUtils.equals(getMode(context), getRenderer().getDrillDownMode()) && context.getAxis() != null && context.getCellType() != CellType.Aggregation; if (enabled) { enabled = (getRenderer().getEnableColumnDrillDown() && context.getAxis().equals(Axis.COLUMNS)) || (getRenderer().getEnableRowDrillDown() && context.getAxis().equals(Axis.ROWS)); } return enabled; }
From source file:be.fedict.eid.pkira.portal.registration.RegistrationEmailVerificationValidator.java
@Override public boolean isValid(Object value) { if (value == null) { return true; }/* w ww. j ava2 s . co m*/ if (value instanceof Registration) { Registration registration = (Registration) value; return ObjectUtils.equals(registration.getEmailAddress(), registration.getEmailAddressVerification()); } return false; }
From source file:com.opengamma.analytics.financial.sensitivity.ValueGreek.java
@Override public boolean equals(final Object obj) { if (this == obj) { return true; }//from www . j a va2 s . c o m if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ValueGreek other = (ValueGreek) obj; return ObjectUtils.equals(_underlyingGreek, other._underlyingGreek); }
From source file:com.opengamma.masterdb.security.hibernate.EnumBean.java
@Override public boolean equals(final Object o) { if (!(o instanceof EnumBean)) { return false; }// w w w . ja va 2 s. c om final EnumBean other = (EnumBean) o; if (getId() != -1 && other.getId() != -1) { return getId().longValue() == other.getId().longValue(); } return ObjectUtils.equals(other.getName(), getName()); }
From source file:com.healthmarketscience.jackcess.SimpleColumnMatcher.java
public boolean matches(Table table, String columnName, Object value1, Object value2) { return ObjectUtils.equals(value1, value2); }
From source file:com.haulmont.cuba.gui.data.impl.testmodel1.TestPartEntity.java
public void setPartName(String partName) { String o = this.partName; this.partName = partName; if (!ObjectUtils.equals(o, partName)) propertyChanged("partName", o, partName); }