net.datafaker.providers.base.PhoneNumber Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of datafaker Show documentation
Show all versions of datafaker Show documentation
This library is a improved port of JavaFaker (as well as Ruby's stympy/faker gem and Perl's Data::Faker library) that
generates fake data.
It's useful when you're developing a new project and need some pretty data for showcase.
package net.datafaker.providers.base;
/**
* @since 0.8.0
*/
public class PhoneNumber extends AbstractProvider {
protected PhoneNumber(BaseProviders faker) {
super(faker);
}
public String cellPhone() {
return faker.numerify(resolve("cell_phone.formats"));
}
/**
* Generates locale specific phone number in national format.
*
* @return phone number
*/
public String phoneNumber() {
return phoneNumberNational();
}
public String phoneNumberInternational() {
return faker.numerify(resolve("phone_number.formats_international"));
}
public String phoneNumberNational() {
return faker.numerify(resolve("phone_number.formats"));
}
public String extension() {
return subscriberNumber();
}
public String subscriberNumber(int length) {
return faker.numerify("#".repeat(Math.max(0, length)));
}
public String subscriberNumber() {
return subscriberNumber(4);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy