List of usage examples for org.apache.commons.lang.builder HashCodeBuilder append
public HashCodeBuilder append(short[] array)
Append a hashCode
for a short
array.
From source file:jp.go.nict.langrid.dao.entity.ResourceType.java
@Override protected HashCodeBuilder appendSpecialHashCode(HashCodeBuilder builder, Collection<String> appendedFields) { HashCodeBuilder b = super.appendSpecialHashCode(builder, appendedFields); appendedFields.add("metaAttributes"); if (metaAttributes != null) { b.append(metaAttributes.entrySet()); }/*w w w. j av a 2 s. co m*/ return b; }
From source file:net.kamhon.ieagle.function.user.vo.UserAccess.java
public int hashCode() { HashCodeBuilder hashCode = new HashCodeBuilder(); if (accessCode != null) hashCode.append(accessCode); return hashCode.toHashCode(); }
From source file:eu.datex2.schema._2_0rc2._2_0.Situation.java
/** * Hash code./*w ww .j a v a 2s . co m*/ * * @param hashCodeBuilder the hash code builder */ public void hashCode(HashCodeBuilder hashCodeBuilder) { hashCodeBuilder.append(this.getHeaderInformation()); hashCodeBuilder.append(this.getSituationRecord()); hashCodeBuilder.append(this.getSituationExtension()); hashCodeBuilder.append(this.getId()); hashCodeBuilder.append(this.getVersion()); }
From source file:com.google.code.simplestuff.bean.SimpleBean.java
/** * // ww w. j av a 2 s . c o m * Returns the hashCode basing considering only the {@link BusinessField} * annotated fields. * * @param bean The bean. * @return The hashCode result. * @throws IllegalArgumentException If the bean is not a Business Object. */ public static int hashCode(Object bean) { if (bean == null) { throw new IllegalArgumentException("The bean passed is null!!!"); } BusinessObjectDescriptor businessObjectInfo = BusinessObjectContext .getBusinessObjectDescriptor(bean.getClass()); // We don't need here a not null check since by contract the // getBusinessObjectDescriptor method always returns an abject. if (businessObjectInfo.getNearestBusinessObjectClass() == null) { return bean.hashCode(); // throw new IllegalArgumentException( // "The bean passed is not annotated in the hierarchy as Business Object!!!"); } Collection<Field> annotatedField = businessObjectInfo.getAnnotatedFields(); HashCodeBuilder builder = new HashCodeBuilder(); for (Field field : annotatedField) { field.setAccessible(true); final BusinessField fieldAnnotation = field.getAnnotation(BusinessField.class); if ((fieldAnnotation != null) && (fieldAnnotation.includeInHashCode())) { try { // Vincenzo Vitale(vita) May 23, 2007 2:39:26 PM: some // date implementations give not equals values... if ((ClassUtils.isAssignable(field.getType(), Date.class)) || (ClassUtils.isAssignable(field.getType(), Calendar.class))) { Object fieldValue = PropertyUtils.getProperty(bean, field.getName()); if (fieldValue != null) { builder.append(DateUtils.round(fieldValue, Calendar.MILLISECOND)); } } else { builder.append(PropertyUtils.getProperty(bean, field.getName())); } } catch (IllegalAccessException e) { if (log.isDebugEnabled()) { log.debug("IllegalAccessException exception when calculating the hashcode of class" + bean.getClass().toString(), e); } } catch (InvocationTargetException e) { if (log.isDebugEnabled()) { log.debug("InvocationTargetException exception when calculating the hashcode of class" + bean.getClass().toString(), e); } } catch (NoSuchMethodException e) { if (log.isDebugEnabled()) { log.debug("NoSuchMethodException exception when calculating the hashcode of class" + bean.getClass().toString(), e); } } } } return builder.toHashCode(); }
From source file:eu.larkc.iris.storage.FactsScheme.java
@Override public int hashCode() { if (atom != null) { return new HashCodeBuilder().appendSuper(super.hashCode()).append(storageId.hashCode()) .append(atom.hashCode()).toHashCode(); } else if (predicates != null) { HashCodeBuilder hab = new HashCodeBuilder().appendSuper(super.hashCode()).append(storageId.hashCode()); for (IPredicate predicate : predicates) { hab.append(predicate.hashCode()); }// w w w.j a v a2 s . com return hab.toHashCode(); } else { return super.hashCode(); } }
From source file:com.disney.opa.dom.comment.Comment.java
@Override public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(); builder.append(commentID); builder.append(commentDate);//from www .java 2s . com builder.append(commentText); return builder.toHashCode(); }
From source file:com.autentia.wuija.security.impl.hibernate.HibernateSecurityUser.java
@Override public int hashCode() { final HashCodeBuilder hashCodeBuilder = new HashCodeBuilder(); hashCodeBuilder.append(getUsername()); hashCodeBuilder.append(getPassword()); return hashCodeBuilder.toHashCode(); }
From source file:ch.systemsx.cisd.openbis.generic.shared.dto.MaterialPE.java
@Override public final int hashCode() { final HashCodeBuilder builder = new HashCodeBuilder(); builder.append(getCode()); builder.append(getMaterialType());//from w w w . java 2 s .co m return builder.toHashCode(); }
From source file:jp.go.nict.langrid.dao.entity.ServiceType.java
@Override protected HashCodeBuilder appendSpecialHashCode(HashCodeBuilder builder, Collection<String> appendedFields) { HashCodeBuilder b = super.appendSpecialHashCode(builder, appendedFields); appendedFields.add("interfaceDefinitions"); return b.append(interfaceDefinitions.entrySet()); }
From source file:de.iteratec.iteraplan.model.attribute.AttributeValue.java
@Override public int hashCode() { HashCodeBuilder hashCodeBuilder = new HashCodeBuilder(); if (getId() == null) { hashCodeBuilder.appendSuper(super.hashCode()); } else {//w w w .java 2s. com hashCodeBuilder.append(getId()); } return hashCodeBuilder.toHashCode(); }