public class IdMultiPartHashGenerator extends Object
A class that will take a long Confluence Id and converted it to a multi-part hash with a particular number of parts.
The split point of the Id is specified by the number of digits in each split.
e.g. 565321 with a split size of 3 will split to 565 and 321.
The actual value for each part will be the modulo of the part with the specified module value. So in the above example if a modulo of 250 is given then the split parts returned would be 65 and 71 and you know you will have a maximum of 250 possible distinct values for each part.
The number of parts property specifies exactly how many parts will be returned on each split. An Id which doesn't
have enough parts will have zero value returned for any missing parts.
e.g. with a modulo=250, split=3 and parts=4 applied to the Id 436854 the returned parts will be 0, 0, 186, 104.
Instances of this class are thread safe.
|Constructor and Description|
|Modifier and Type||Method and Description|
Create the multipart hash for the supplied value.
public IdMultiPartHashGenerator(int split, int modulo, int parts)
split- the number of digits in each part. Must be between 1 and 9.
modulo- the value to be used in the modulo calculation. Must be greater than 0.
parts- the number of parts to be created. Must be greater than 0.
IllegalArgumentException- if any of the parameters are out of range.
value- the value to be split
IllegalArgumentException- if the supplied value is less than 0
public int getSplit()
Copyright © 2003–2016 Atlassian. All rights reserved.