@NotThreadSafe public static class

ModuleDescriptors.HashCodeBuilder

extends Object
java.lang.Object
   ↳ com.atlassian.plugin.descriptors.ModuleDescriptors.HashCodeBuilder

Class Overview

Assists in implementing hashCode() methods for module descriptors based on the hashCode of their complete key.

The full specification of the hashCode() contract is defined by hashCode()

Usage:

  1. If you are using this builder to implement the hashCode() method in a module descriptor implementation:

    new ModuleDescriptors.HashCodeBuilder().descriptor(this).toHashCode();

  2. If you are using this builder to calculate the hashCode of a descriptor from outside a module descriptor implementation; given a descriptor instance desc:

    new ModuleDescriptors.EqualsBuilder().descriptor(desc).toHashCode();

Summary

Public Constructors
ModuleDescriptors.HashCodeBuilder()
Public Methods
ModuleDescriptors.HashCodeBuilder descriptor(ModuleDescriptor descriptor)
Sets the module descriptor to create a hashCode implementation for.
int hashCode()
The computed hashCode from toHashCode() is returned due to the likelihood of bugs in mis-calling toHashCode() and the unlikeliness of it mattering what the hashCode for HashCodeBuilder itself is.
int toHashCode()
Return the computed hashCode for this module descriptor.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ModuleDescriptors.HashCodeBuilder ()

Public Methods

public ModuleDescriptors.HashCodeBuilder descriptor (ModuleDescriptor descriptor)

Sets the module descriptor to create a hashCode implementation for.

Parameters
descriptor the descriptor. Must not be null.
Returns
  • this builder.

public int hashCode ()

The computed hashCode from toHashCode() is returned due to the likelihood of bugs in mis-calling toHashCode() and the unlikeliness of it mattering what the hashCode for HashCodeBuilder itself is.

Returns
  • hashCode based on the complete key of the module descriptor.

public int toHashCode ()

Return the computed hashCode for this module descriptor.

Returns
  • hashCode based on the hashCode of the complete key of the module descriptor.