|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.rim.pushsdk.commons.Validator
public class Validator
Provides a collection of validation methods.
| Constructor Summary | |
|---|---|
Validator()
|
|
| Method Summary | |
|---|---|
static void |
assertContains(String part,
String str,
String errorMessage)
Verifies that the given string contains the specified substring. |
static void |
assertDate1BeforeDate2(Date date1,
Date date2,
String errorMessage)
Verifies that date1 is before date2 in time. |
static void |
assertDateInFuture(Date date,
String errorMessage)
Verifies that the given date is in the future. |
static void |
assertDateInPast(Date date,
String errorMessage)
Verifies that the given date is in the past. |
static void |
assertEndsWith(String suffix,
String str,
String errorMessage)
Verifies that the given string ends with the specified suffix. |
static void |
assertEqual(boolean b1,
boolean b2,
String errorMessage)
Verifies that two booleans are equal. |
static void |
assertEqual(String str1,
String str2,
String errorMessage)
Verifies that the given strings are equal. |
static void |
assertFalse(boolean b,
String errorMessage)
Verifies that the given boolean is set to false. |
static void |
assertFromAndToDatesConsistent(Date fromDate,
Date toDate)
Verifies that the from date and to dates are both not null and that the from date comes before the to date. |
static void |
assertGreaterThan(int value1,
int value2,
String errorMessage)
Verifies that the first value is greater than the second value. |
static void |
assertIndexesConsistent(int startIndex,
int endIndex)
Verifies that the start index and end index are both positive numbers (i.e. |
static void |
assertInRange(int value,
int lowerLimit,
int upperLimit,
String errorMessage)
Verifies that the given value exists between the lower and upper limits. |
static void |
assertLengthEquals(int length,
String str,
String errorMessage)
Verifies that the given string has the specified length. |
static void |
assertLengthGreater(int length,
String str,
String errorMessage)
Verifies that the given string has a length greater than the specified length. |
static void |
assertLengthGreaterEqual(int length,
String str,
String errorMessage)
Verifies that the given string has a length greater than or equal to the specified length. |
static void |
assertLengthLess(int length,
String str,
String errorMessage)
Verifies that the given string has a length less than the specified length. |
static void |
assertLengthLessEqual(int length,
String str,
String errorMessage)
Verifies that the given string has a length less than or equal to the specified length. |
static void |
assertLessEqual(int value1,
int value2,
String errorMessage)
Verifies that the first value is less than or equal to the second value. |
static void |
assertLessThan(int value1,
int value2,
String errorMessage)
Verifies that the first value is less than the second value. |
static void |
assertNonNegative(long value,
String errorMessage)
Verifies that the given value is non-negative (i.e. |
static void |
assertNotContains(String part,
String str,
String errorMessage)
Verifies that the given string does not contain the specified substring. |
static void |
assertNotEmpty(Collection<?> collection,
String errorMessage)
Verifies that the given collection is not empty. |
static void |
assertNotEmpty(Content content,
String errorMessage)
Verifies that the given content is not empty. |
static void |
assertNotEmpty(List<?> list,
String errorMessage)
Verifies that the given list is not empty. |
static void |
assertNotEmpty(Set<?> set,
String errorMessage)
Verifies that the given set is not empty. |
static void |
assertNotEmpty(String str,
String errorMessage)
Verifies that the given string is not empty. |
static void |
assertNotEqual(boolean b1,
boolean b2,
String errorMessage)
Verifies that two booleans are not equal. |
static void |
assertNotEqual(String str1,
String str2,
String errorMessage)
Verifies that the given strings are not equal. |
static void |
assertNotNull(Object object,
String errorMessage)
Verifies that the given object is not null. |
static void |
assertNull(Object object,
String errorMessage)
Verifies that the given object is null. |
static void |
assertNullOrEmpty(String str,
String errorMessage)
Verifies that the given string is either null or empty. |
static void |
assertPositive(long value,
String errorMessage)
Verifies that the given value is positive (i.e. |
static void |
assertSizeLessThanEqual(List<?> list,
int maximumSize,
String errorMessage)
Verifies that the given list is less than or equal to the specified size (i.e. |
static void |
assertTrue(boolean b,
String errorMessage)
Verifies that the given boolean is set to true. |
static void |
assertValidURL(String str,
String errorMessage)
Verifies that a passed in string is a valid URL. |
static void |
asssertGreaterEqual(int value1,
int value2,
String errorMessage)
Verifies that the first value is greater than or equal to the second value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Validator()
| Method Detail |
|---|
public static void assertTrue(boolean b,
String errorMessage)
b - the boolean to validateerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertFalse(boolean b,
String errorMessage)
b - the boolean to validateerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertNull(Object object,
String errorMessage)
object - the object to validateerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertNullOrEmpty(String str,
String errorMessage)
str - the string to validateerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertNotNull(Object object,
String errorMessage)
object - the object to validateerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertNotEmpty(Content content,
String errorMessage)
content - the content to validateerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertNotEmpty(String str,
String errorMessage)
str - the string to validateerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertLengthEquals(int length,
String str,
String errorMessage)
length - the expected length of the stringstr - the string to validateerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertLengthGreater(int length,
String str,
String errorMessage)
length - the length to compare againststr - the string to validateerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertLengthGreaterEqual(int length,
String str,
String errorMessage)
length - the length to compare againststr - the string to validateerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertLengthLess(int length,
String str,
String errorMessage)
length - the length to compare againststr - the string to validateerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertLengthLessEqual(int length,
String str,
String errorMessage)
length - the length to compare againststr - the string to validateerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertContains(String part,
String str,
String errorMessage)
part - the substringstr - the string to validateerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertNotContains(String part,
String str,
String errorMessage)
part - the substringstr - the string to validateerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertEqual(String str1,
String str2,
String errorMessage)
str1 - the first stringstr2 - the second stringerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertNotEqual(String str1,
String str2,
String errorMessage)
str1 - the first stringstr2 - the second stringerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertEndsWith(String suffix,
String str,
String errorMessage)
suffix - the suffixstr - the string to validateerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertNotEmpty(List<?> list,
String errorMessage)
list - the list to validateerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertSizeLessThanEqual(List<?> list,
int maximumSize,
String errorMessage)
list - the list to validatemaximumSize - the maximum size the list can be (must be a positive number)errorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertNotEmpty(Set<?> set,
String errorMessage)
set - the set to validateerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertNotEmpty(Collection<?> collection,
String errorMessage)
collection - the collection to validateerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertDateInPast(Date date,
String errorMessage)
date - the date to validateerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertDateInFuture(Date date,
String errorMessage)
date - the date to validateerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertDate1BeforeDate2(Date date1,
Date date2,
String errorMessage)
date1 - the first date to use in the comparisondate2 - the second date to use in the comparisonerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertFromAndToDatesConsistent(Date fromDate,
Date toDate)
fromDate - the from datetoDate - to to date
IllegalArgumentException - if the assertion fails
public static void assertIndexesConsistent(int startIndex,
int endIndex)
startIndex - the start indexendIndex - the end index
IllegalArgumentException - if the assertion fails
public static void assertInRange(int value,
int lowerLimit,
int upperLimit,
String errorMessage)
value - the value to validatelowerLimit - the lower limitupperLimit - the upper limiterrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertNonNegative(long value,
String errorMessage)
value - the value to validateerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertPositive(long value,
String errorMessage)
value - the value to validateerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertGreaterThan(int value1,
int value2,
String errorMessage)
value1 - the first valuevalue2 - the second valueerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void asssertGreaterEqual(int value1,
int value2,
String errorMessage)
value1 - the first valuevalue2 - the second valueerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertLessThan(int value1,
int value2,
String errorMessage)
value1 - the first valuevalue2 - the second valueerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertLessEqual(int value1,
int value2,
String errorMessage)
value1 - the first valuevalue2 - the second valueerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertEqual(boolean b1,
boolean b2,
String errorMessage)
b1 - the first booleanb2 - the second booleanerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertNotEqual(boolean b1,
boolean b2,
String errorMessage)
b1 - the first booleanb2 - the second booleanerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
public static void assertValidURL(String str,
String errorMessage)
str - the string to validateerrorMessage - the error message to be logged with a warning and wrapped in an IllegalArgumentException
IllegalArgumentException - if the assertion fails
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||