|
Liferay 6.0-ee-sp2 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.liferay.portal.kernel.util.Validator
public class Validator
Provides utility methods related to data validation and format checking.
| Constructor Summary | |
|---|---|
Validator()
|
|
| Method Summary | |
|---|---|
static boolean |
equals(boolean boolean1,
boolean boolean2)
Determines if the booleans are equal. |
static boolean |
equals(byte byte1,
byte byte2)
Determines if the bytes are equal. |
static boolean |
equals(char char1,
char char2)
Determines if the characters are equal. |
static boolean |
equals(double double1,
double double2)
Determines if the doubles are equal. |
static boolean |
equals(float float1,
float float2)
Determines if the floats are equal. |
static boolean |
equals(int int1,
int int2)
Determines if the integers are equal. |
static boolean |
equals(long long1,
long long2)
Determines if the long integers are equal. |
static boolean |
equals(Object obj1,
Object obj2)
Determines if the objects are either equal, the same instance, or both null. |
static boolean |
equals(short short1,
short short2)
Determines if the short integers are equal. |
static boolean |
isAddress(String address)
Determines if the string is an email address. |
static boolean |
isAlphanumericName(String name)
Determines if the string is an alphanumeric name, meaning it contains nothing but English letters, numbers, and spaces. |
static boolean |
isAscii(char c)
Determines if the character is in the ASCII character set. |
static boolean |
isChar(char c)
Determines if the character is an upper or lower case English letter. |
static boolean |
isChar(String s)
Determines if string consists only of upper and lower case English letters. |
static boolean |
isDate(int month,
int day,
int year)
Determines if the date is valid in the Gregorian calendar. |
static boolean |
isDigit(char c)
Determines if the character is a digit between 0 and 9 (inclusive). |
static boolean |
isDigit(String s)
Determines if the string consists of only digits between 0 and 9 (inclusive). |
static boolean |
isDomain(String domainName)
Determines if the string is a valid domain name. |
static boolean |
isEmailAddress(String emailAddress)
Determines if the string is a valid email address. |
static boolean |
isEmailAddressSpecialChar(char c)
Determines if the character is a special character in an email address. |
static boolean |
isGregorianDate(int month,
int day,
int year)
Determines if the date is valid in the Gregorian calendar. |
static boolean |
isHex(String s)
Determines if the string is a hexidecimal number. |
static boolean |
isHTML(String s)
Determines if the string is an HTML document. |
static boolean |
isIPAddress(String ipAddress)
Determines if the string is a valid IPv4 IP address. |
static boolean |
isJulianDate(int month,
int day,
int year)
Determines if the date is valid in the Julian calendar. |
static boolean |
isLUHN(String number)
Determines if the string contains a valid number according to the Luhn algorithm, commonly used to validate credit card numbers. |
static boolean |
isName(String name)
Determines if the string is a name, meaning it contains nothing but English letters and spaces. |
static boolean |
isNotNull(Long l)
Determines if the long number object is not null, meaning it
is neither a null reference or zero. |
static boolean |
isNotNull(Object obj)
Determines if the object is not null, using the rules from
isNotNull(Long) or isNotNull(String) if the object is
one of these types. |
static boolean |
isNotNull(Object[] array)
Determines if the array is not null, meaning it is neither a
null reference or empty. |
static boolean |
isNotNull(String s)
Determines if the string is not null, meaning it is not a
null reference, nothing but spaces, or the string
"null". |
static boolean |
isNull(Long l)
Determines if the long number object is null, meaning it is
either a null reference or zero. |
static boolean |
isNull(Object obj)
Determines if the object is null, using the rules from
isNull(Long) or isNull(String) if the object is one of
these types. |
static boolean |
isNull(Object[] array)
Determines if the array is null, meaning it is either a
null reference or empty. |
static boolean |
isNull(String s)
Determines if the string is null, meaning it is a
null reference, nothing but spaces, or the string
"null". |
static boolean |
isNumber(String number)
Determines if the string is a decimal integer number, meaning it contains nothing but decimal digits. |
static boolean |
isPassword(String password)
Determines if the string is a valid password, meaning it is at least four characters long and contains only letters and decimal digits. |
static boolean |
isPhoneNumber(String phoneNumber)
Determines if the string is a valid phone number. |
static boolean |
isUrl(String url)
Determines if the string is a valid URL based on the rules in URL. |
static boolean |
isVariableName(String variableName)
Determines if the string is a valid variable name in Java. |
static boolean |
isVariableTerm(String s)
Determines if the string is a valid variable term, meaning it begins with "[$" and ends with "$]". |
static boolean |
isWhitespace(char c)
Determines if the character is whitespace, meaning it is either the null character '0' or whitespace according to Character.isWhitespace(char). |
static boolean |
isXml(String s)
Determines if the string is an XML document. |
| 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 boolean equals(boolean boolean1,
boolean boolean2)
boolean1 - the first booleanboolean2 - the second boolean
true if the booleans are equal; false
otherwise
public static boolean equals(byte byte1,
byte byte2)
byte1 - the first bytebyte2 - the second byte
true if the bytes are equal; false
otherwise
public static boolean equals(char char1,
char char2)
char1 - the first characterchar2 - the second character
true if the characters are equal; false
otherwise
public static boolean equals(double double1,
double double2)
double1 - the first doubledouble2 - the second double
true if the doubles are equal; false
otherwise
public static boolean equals(float float1,
float float2)
float1 - the first floatfloat2 - the second float
true if the floats are equal; false
otherwise
public static boolean equals(int int1,
int int2)
int1 - the first integerint2 - the second integer
true if the integers are equal; false
otherwise
public static boolean equals(long long1,
long long2)
long1 - the first long integerlong2 - the second long integer
true if the long integers are equal;
false otherwise
public static boolean equals(Object obj1,
Object obj2)
null.
obj1 - the first objectobj2 - the second object
true if the objects are either equal, the same
instance, or both null; false otherwise
public static boolean equals(short short1,
short short2)
short1 - the first short integershort2 - the second short integer
true if the short integers are equal;
false otherwisepublic static boolean isAddress(String address)
address - the string to check
true if the string is an email address;
false otherwisepublic static boolean isAlphanumericName(String name)
name - the string to check
true if the string is an Alphanumeric name;
false otherwisepublic static boolean isAscii(char c)
c - the character to check
true if the character is in the ASCII character set;
false otherwisepublic static boolean isChar(char c)
c - the character to check
true if the character is an upper or lower case
English letter; false otherwisepublic static boolean isChar(String s)
s - the string to check
true if the string consists only of upper and lower
case English letters
public static boolean isDate(int month,
int day,
int year)
month - the month to checkday - the day to check
true if the date is valid in the Gregorian calendar;
false otherwisepublic static boolean isDigit(char c)
c - the character to check
true if the character is a digit between 0 and 9
(inclusive); false otherwisepublic static boolean isDigit(String s)
s - the string to check
true if the string consists of only digits between 0
and 9 (inclusive); false otherwisepublic static boolean isDomain(String domainName)
domainName - the string to check
true if the string is a valid domain name;
false otherwisepublic static boolean isEmailAddress(String emailAddress)
emailAddress - the string to check
true if the string is a valid email address;
false otherwisepublic static boolean isEmailAddressSpecialChar(char c)
c - the character to check
true if the character is a special character in an
email address; false otherwise
public static boolean isGregorianDate(int month,
int day,
int year)
month - the month (0-based, meaning 0 for January)day - the day of the monthyear - the year
true if the date is valid; false
otherwisepublic static boolean isHex(String s)
null; it does not
actually check the format of the string.
s - the string to check
true if the string is a hexidecimal number;
false otherwiseisNull(String)public static boolean isHTML(String s)
s - the string to check
true if the string is an HTML document;
false otherwisepublic static boolean isIPAddress(String ipAddress)
ipAddress - the string to check
true if the string is an IPv4 IP address;
false otherwise
public static boolean isJulianDate(int month,
int day,
int year)
month - the month (0-based, meaning 0 for January)day - the day of the monthyear - the year
true if the date is valid; false
otherwisepublic static boolean isLUHN(String number)
number - the string to check
true if the string contains a valid number according
to the Luhn algorithm; false otherwisepublic static boolean isName(String name)
name - the string to check
true if the string is a name; false
otherwisepublic static boolean isNotNull(Long l)
null, meaning it
is neither a null reference or zero.
l - the long number object to check
true if the long number object is not
null; false otherwisepublic static boolean isNotNull(Object obj)
null, using the rules from
isNotNull(Long) or isNotNull(String) if the object is
one of these types.
obj - the object to check
true if the object is not null;
false otherwisepublic static boolean isNotNull(Object[] array)
null, meaning it is neither a
null reference or empty.
array - the array to check
true if the array is not null;
false otherwisepublic static boolean isNotNull(String s)
null, meaning it is not a
null reference, nothing but spaces, or the string
"null".
s - the string to check
true if the string is not null;
false otherwisepublic static boolean isNull(Long l)
null, meaning it is
either a null reference or zero.
l - the long number object to check
true if the long number object is null;
false otherwisepublic static boolean isNull(Object obj)
null, using the rules from
isNull(Long) or isNull(String) if the object is one of
these types.
obj - the object to check
true if the object is null;
false otherwisepublic static boolean isNull(Object[] array)
null, meaning it is either a
null reference or empty.
array - the array to check
true if the array is null;
false otherwisepublic static boolean isNull(String s)
null, meaning it is a
null reference, nothing but spaces, or the string
"null".
s - the string to check
true if the string is null;
false otherwisepublic static boolean isNumber(String number)
number - the string to check
true if the string is a decimal integer number;
false otherwisepublic static boolean isPassword(String password)
true if the string is a valid password;
false otherwisepublic static boolean isPhoneNumber(String phoneNumber)
phoneNumber - the string to check
true if the string is a valid phone number;
false otherwisepublic static boolean isUrl(String url)
URL.
url - the string to check
true if the string is a valid URL;
false otherwisepublic static boolean isVariableName(String variableName)
variableName - the string to check
true if the string is a valid variable name in Java;
false otherwisepublic static boolean isVariableTerm(String s)
s - the string to check
true if the string is a valid variable term;
false otherwisepublic static boolean isWhitespace(char c)
null character '0' or whitespace according to Character.isWhitespace(char).
c - the character to check
true if the character is whitespace;
false otherwisepublic static boolean isXml(String s)
s - the string to check
true if the string is an XML document;
false otherwise
|
Liferay 6.0-ee-sp2 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||