@Override
 public int hashCode() {
   int hashCode = getClass().hashCode();
   hashCode = 13 * hashCode + ObjectUtils.nullSafeHashCode(this.beanFactory);
   hashCode = 13 * hashCode + ObjectUtils.nullSafeHashCode(this.targetBeanName);
   return hashCode;
 }
 @Override
 public int hashCode() {
   int hashCode = ObjectUtils.nullSafeHashCode(this.getExpression());
   hashCode = 31 * hashCode + ObjectUtils.nullSafeHashCode(this.pointcutDeclarationScope);
   hashCode = 31 * hashCode + ObjectUtils.nullSafeHashCode(this.pointcutParameterNames);
   hashCode = 31 * hashCode + ObjectUtils.nullSafeHashCode(this.pointcutParameterTypes);
   return hashCode;
 }
Example #3
0
 @Override
 public int hashCode() {
   int hashCode = ObjectUtils.nullSafeHashCode(getReadMethod());
   hashCode = 29 * hashCode + ObjectUtils.nullSafeHashCode(getWriteMethod());
   hashCode = 29 * hashCode + ObjectUtils.nullSafeHashCode(getIndexedReadMethod());
   hashCode = 29 * hashCode + ObjectUtils.nullSafeHashCode(getIndexedWriteMethod());
   return hashCode;
 }
Example #4
0
 @Override
 public int hashCode() {
   int hashValue = 17;
   hashValue = 37 * hashValue + ObjectUtils.nullSafeHashCode(getId());
   hashValue = 37 * hashValue + ObjectUtils.nullSafeHashCode(getFirstName());
   hashValue = 37 * hashValue + ObjectUtils.nullSafeHashCode(getLastName());
   return hashValue;
 }
Example #5
0
 @Override
 public int hashCode() {
   int result = 1;
   result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.name);
   result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.reset);
   result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.proxyTargetAware);
   result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.qualifier);
   return result;
 }
Example #6
0
 @Override
 public int hashCode() {
   int hashCode = super.hashCode();
   hashCode = 29 * hashCode + getField().hashCode();
   hashCode = 29 * hashCode + ObjectUtils.nullSafeHashCode(getRejectedValue());
   hashCode = 29 * hashCode + (isBindingFailure() ? 1 : 0);
   return hashCode;
 }
  /**
   * This method uses reflection to build a valid hash code.
   *
   * <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This
   * means that it will throw a security exception if run under a security manager, if the
   * permissions are not set up correctly. It is also not as efficient as testing explicitly.
   *
   * <p>Transient members will not be used, as they are likely derived fields, and not part of the
   * value of the <code>Object</code>.
   *
   * <p>Static fields will not be tested. Superclass fields will be included.
   *
   * @param obj the object to create a <code>hashCode</code> for
   * @return the generated hash code, or zero if the given object is <code>null</code>
   */
  public static int reflectionHashCode(Object obj) {
    if (obj == null) return 0;

    Class<?> targetClass = obj.getClass();
    if (isArrayOfPrimitives(obj)) {
      // || ObjectUtils.isPrimitiveOrWrapper(targetClass)) {
      return ObjectUtils.nullSafeHashCode(obj);
    }

    if (targetClass.isArray()) {
      return reflectionHashCode((Object[]) obj);
    }

    if (obj instanceof Collection) {
      return reflectionHashCode((Collection<?>) obj);
    }

    if (obj instanceof Map) {
      return reflectionHashCode((Map<?, ?>) obj);
    }

    // determine whether the object's class declares hashCode() or has a
    // superClass other than java.lang.Object that declares hashCode()
    Class<?> clazz = (obj instanceof Class) ? (Class<?>) obj : obj.getClass();
    Method hashCodeMethod = ReflectionUtils.findMethod(clazz, "hashCode", new Class[0]);

    if (hashCodeMethod != null) {
      return obj.hashCode();
    }

    // could not find a hashCode other than the one declared by
    // java.lang.Object
    int hash = INITIAL_HASH;

    try {
      while (targetClass != null) {
        Field[] fields = targetClass.getDeclaredFields();
        AccessibleObject.setAccessible(fields, true);

        for (int i = 0; i < fields.length; i++) {
          Field field = fields[i];
          int modifiers = field.getModifiers();

          if (!Modifier.isStatic(modifiers) && !Modifier.isTransient(modifiers)) {
            hash = MULTIPLIER * hash + reflectionHashCode(field.get(obj));
          }
        }
        targetClass = targetClass.getSuperclass();
      }
    } catch (IllegalAccessException exception) {
      // ///CLOVER:OFF
      ReflectionUtils.handleReflectionException(exception);
      // ///CLOVER:ON
    }

    return hash;
  }
Example #8
0
 @Override
 public int hashCode() {
   int hashCode = ObjectUtils.nullSafeHashCode(project);
   return getElementType() * hashCode + super.hashCode();
 }
Example #9
0
 public int hashCode(Object x) throws HibernateException {
   return ObjectUtils.nullSafeHashCode(x);
 }
 @Override
 public int hashCode() {
   return ObjectUtils.nullSafeHashCode(this.connectionPool) * 29
       + ObjectUtils.nullSafeHashCode(this.getGeneral()) * 29
       + ObjectUtils.nullSafeHashCode(this.getConnection()) * 29;
 }
 @Override
 public int hashCode() {
   int hashCode = ObjectUtils.nullSafeHashCode(beanClass);
   return 29 * hashCode + ObjectUtils.nullSafeHashCode(beans);
 }
Example #12
0
 @Override
 public int hashCode() {
   return ObjectUtils.nullSafeHashCode(storage);
 }
 /*
  * (non-Javadoc)
  * @see org.springframework.data.util.TypeDiscoverer#hashCode()
  */
 @Override
 public int hashCode() {
   return super.hashCode() + 31 * ObjectUtils.nullSafeHashCode(parent);
 }
Example #14
0
 /* (non-Javadoc)
  * @see java.lang.Object#hashCode()
  */
 @Override
 public int hashCode() {
   return ObjectUtils.nullSafeHashCode(this.id);
 }
 @Override
 public final int hashCode() {
   return ObjectUtils.nullSafeHashCode(this.key) ^ ObjectUtils.nullSafeHashCode(this.value);
 }
 @Override
 public int hashCode() {
   return ObjectUtils.nullSafeHashCode(this.enabled) * 29
       + ObjectUtils.nullSafeHashCode(this.history) * 29
       + ObjectUtils.nullSafeHashCode(this.threshold) * 29;
 }
 @Override
 public int hashCode() {
   return super.hashCode() * 29 + ObjectUtils.nullSafeHashCode(this.statusCode);
 }
Example #18
0
 @Override
 public int hashCode() {
   return (ObjectUtils.nullSafeHashCode(getReadMethod()) * 29
       + ObjectUtils.nullSafeHashCode(getWriteMethod()));
 }