public class ValidationUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
APPBOY_STRING_MAX_LENGTH |
Constructor and Description |
---|
ValidationUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
ensureBrazeFieldLength(java.lang.String field) |
static boolean |
isValidEmailAddress(java.lang.String emailAddress)
Validates an email address.
|
static boolean |
isValidLocation(double latitude,
double longitude) |
static boolean |
isValidLogCustomEventInput(java.lang.String eventName,
ServerConfigStorageProvider serverConfigStorageProvider)
Validates the event name for the custom event.
|
static boolean |
isValidLogPurchaseInput(java.lang.String productId,
java.lang.String currencyCode,
java.math.BigDecimal price,
int quantity,
ServerConfigStorageProvider serverConfigStorageProvider)
Validates the log purchase event parameters.
|
static boolean |
isValidPhoneNumber(java.lang.String phoneNumber)
Performs basic validation on input string.
|
static boolean |
isValidPushStoryClickInput(java.lang.String campaignId,
java.lang.String pageId)
Validates the campaign id and page id for the push story click.
|
public static final int APPBOY_STRING_MAX_LENGTH
public static boolean isValidEmailAddress(java.lang.String emailAddress)
emailAddress
- string representing email addressEMAIL_ADDRESS_REGEX
,
EMAIL_ADDRESS_MAX_LENGTH
public static boolean isValidPhoneNumber(java.lang.String phoneNumber)
public static java.lang.String ensureBrazeFieldLength(java.lang.String field)
field
- public static boolean isValidLogPurchaseInput(java.lang.String productId, java.lang.String currencyCode, java.math.BigDecimal price, int quantity, ServerConfigStorageProvider serverConfigStorageProvider)
productId
- The product Id. Must be non-empty and not in the blocklist.currencyCode
- The currency code. Must be non-empty and in the list of VALID_CURRENCY_CODES.price
- The price. Must not be null.quantity
- The quantity of purchases. Must be 1 or greater.serverConfigStorageProvider
- The server configuration. Used to check against blocklisted purchases.public static boolean isValidLogCustomEventInput(java.lang.String eventName, ServerConfigStorageProvider serverConfigStorageProvider)
eventName
- The event name.serverConfigStorageProvider
- The server configuration. Used to check against blocklisted events.public static boolean isValidPushStoryClickInput(java.lang.String campaignId, java.lang.String pageId)
campaignId
- The campaign id.pageId
- The page id.public static boolean isValidLocation(double latitude, double longitude)