Package com.atlassian.plugin.descriptors
Class ModuleDescriptors.HashCodeBuilder
java.lang.Object
com.atlassian.plugin.descriptors.ModuleDescriptors.HashCodeBuilder
- Enclosing class:
- ModuleDescriptors
Assists in implementing
Object.hashCode() methods for module descriptors based on the hashCode
of their complete key.
The full specification of the hashCode() contract is defined by
ModuleDescriptor.hashCode()
Usage:
- If you are using this builder to implement the
hashCode()method in a module descriptor implementation:new ModuleDescriptors.HashCodeBuilder().descriptor(this).toHashCode(); - 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();
- Since:
- 2.8.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondescriptor(ModuleDescriptor descriptor) Sets the module descriptor to create ahashCodeimplementation for.inthashCode()The computedhashCodefrom 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.intReturn the computedhashCodefor this module descriptor.
-
Constructor Details
-
HashCodeBuilder
public HashCodeBuilder()
-
-
Method Details
-
descriptor
Sets the module descriptor to create ahashCodeimplementation for.- Parameters:
descriptor- the descriptor. Must not be null.- Returns:
- this builder.
-
toHashCode
public int toHashCode()Return the computedhashCodefor this module descriptor.- Returns:
hashCodebased on the hashCode of the complete key of the module descriptor.
-
hashCode
public int hashCode()The computedhashCodefrom 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.
-