@@ -0,0 +1,2996 @@
+package me.xdrop.jrand.generators.location;%0A%0Aimport me.xdrop.jrand.Generator;%0Aimport me.xdrop.jrand.annotation.Facade;%0Aimport me.xdrop.jrand.annotation.PropertyFlag;%0Aimport me.xdrop.jrand.data.Assets;%0Aimport me.xdrop.jrand.generators.basics.NaturalGenerator;%0Aimport me.xdrop.jrand.generators.basics.StringGenerator;%0Aimport me.xdrop.jrand.utils.Choose;%0A%0Aimport java.util.List;%0A%0A@Facade(accessor = %22phone%22)%0Apublic class PhoneGenerator extends Generator%3CString%3E %7B%0A%0A    @PropertyFlag(%22Enable formatting the phone number%22)%0A    private boolean formatted;%0A%0A    @PropertyFlag(%22Return a mobile number%22)%0A    private boolean mobile;%0A%0A    @PropertyFlag(%22Return a landline number%22)%0A    private boolean landline;%0A%0A    @PropertyFlag(%22Return a UK phone number%22)%0A    private boolean uk;%0A%0A    @PropertyFlag(%22Return a US phone number%22)%0A    private boolean us;%0A%0A    private StringGenerator string;%0A    private NaturalGenerator nat;%0A    private AreaCodeGenerator areacode;%0A    private String format;%0A    private List%3CString%3E prefixesUKLand;%0A    private List%3CString%3E prefixesUKMobile;%0A%0A    public PhoneGenerator() %7B%0A        this.string = new StringGenerator();%0A        this.nat = new NaturalGenerator();%0A        this.areacode = new AreaCodeGenerator();%0A        this.prefixesUKLand = Assets.UK_PHONE_LAND.loadItems();%0A        this.prefixesUKMobile = Assets.UK_PHONE_MOBILE.loadItems();%0A    %7D%0A%0A    /**%0A     * Specify a custom phone format. Use 'X' for a phone number,%0A     * any other characters will remain as is.%0A     * %3Cp%3E%0A     * eg. XXXX-XXXX%0A     * might return 4521-9732%0A     *%0A     * @param format The string to format with%0A     * @return The same generator%0A     */%0A    public PhoneGenerator custom(String format) %7B%0A        this.format = format;%0A        return this;%0A    %7D%0A%0A    private String generateCustom(String format) %7B%0A        StringBuilder sb = new StringBuilder(format.length());%0A        for (char c : format.toCharArray()) %7B%0A            if (c == 'X') %7B%0A                sb.append(string.gen());%0A            %7D else %7B%0A                sb.append(c);%0A            %7D%0A        %7D%0A        return sb.toString();%0A    %7D%0A%0A%0A    @Override%0A    public String gen() %7B%0A        if (format != null) %7B%0A            return generateCustom(format);%0A        %7D%0A%0A        String number;%0A%0A        if (uk) %7B%0A            String prefix;%0A            if (mobile) %7B%0A                prefix = Choose.one(prefixesUKMobile);%0A            %7D else if (landline) %7B%0A                prefix = Choose.one(prefixesUKLand);%0A            %7D else %7B%0A                prefix = Choose.one(prefixesUKMobile, prefixesUKLand);%0A            %7D%0A            int pad = 11 - prefix.length();%0A            return prefix + nat.range(0, 9).repeat(pad);%0A%0A        %7D else if (us) %7B%0A            String area = areacode.gen();%0A            String exchange = nat.range(2, 9).genString() + nat.range(0, 9).repeat(2);%0A            String subscriber = nat.range(1000, 9999).genString();%0A            number = areacode + %22 %22 + exchange + %22-%22 + subscriber;%0A        %7D%0A        return null;%0A    %7D%0A%7D%0A

Add phone generator