Class DefaultCouponCodeClearTextGenerationStrategy

    • Constructor Detail

      • DefaultCouponCodeClearTextGenerationStrategy

        public DefaultCouponCodeClearTextGenerationStrategy()
    • Method Detail

      • afterPropertiesSet

        public void afterPropertiesSet()
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      • checkMaximumCouponCodesGenerated

        protected void checkMaximumCouponCodesGenerated​(MultiCodeCouponModel coupon,
                                                        int length)
        Checks if the given coupon's couponCodeNumber has exceeded the maximum number of coupon codes that can be generated for the given length.
         The maximum number of coupon codes are:
         length 2               2^8  = 256 coupons
         length 4               2^16 = 65.536 coupons
         length 6               2^24 = 16.777.216 coupons
         length 7               2^32 = 4.294.967.296 coupons
         
      • getBitshifts

        protected int[] getBitshifts()
      • setBitshifts

        public void setBitshifts​(java.util.List<java.lang.Integer> bitshiftsList)
        defines how many bits to shift for each two characters that are created from the seed (the MultiCodeCouponModel.couponCodeNumber) (default values are 0, 8, 16, 24, 32, 40, 48, 56)
      • getOffsets

        protected int[] getOffsets()
      • setOffsets

        public void setOffsets​(java.util.List<java.lang.Integer> offsetsList)
        defines the offset which is added when picking a character from the alphabet. (The default values are 3, 5, 7, 11, 13, 17, 19, 23, meaning that for the first two characters (i.e. one byte) the offset is 3.
      • checkLength

        protected void checkLength​(int length)
        checks that the given length is supported by this strategy (only values 2,4,6,8 are valid)