StringHelper.java 675 Bytes
Newer Older
eddie.woo's avatar
eddie.woo committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
package pwc.taxtech.atms.common;

import org.apache.commons.text.RandomStringGenerator;
import org.springframework.stereotype.Component;

/** @see PwC.Tax.Tech.Atms.Application.Base\Utils\StringHelper.cs */
@Component
public class StringHelper {
    private static RandomStringGenerator randomStringGenerator;
    static {
        RandomStringGenerator.Builder builder = new RandomStringGenerator.Builder();
        char[][] array = { { 'a', 'z' }, { 'A', 'Z' }, { '0', '9' } };
        builder.withinRange(array);
        randomStringGenerator = builder.build();
    }

    public String generateRandomPassword() {
        return randomStringGenerator.generate(9);
    }

}