|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.softslate.commerce.customer.core.FormUtilsImpl
public class FormUtilsImpl
FormUtilsImpl is the default implementation of the
FormUtils interface for the application.
FormUtils| Field Summary | |
|---|---|
(package private) static org.apache.commons.logging.Log |
log
|
| Constructor Summary | |
|---|---|
FormUtilsImpl()
|
|
| Method Summary | |
|---|---|
java.lang.String |
capitalize(java.lang.String stringToCapitalize)
Returns a new string with the first letter of a given string capitalized. |
java.lang.Character |
containsCharacter(java.lang.String string,
java.lang.String characters)
Determines if a given string contains a character residing in another string. |
java.lang.String |
deriveCardType(java.lang.String number)
Given a credit card number, derive its type (Visa, Discover, MasterCard or AMEX). |
boolean |
doCardTypeAndNumberMatch(java.lang.String type,
java.lang.String number)
Given a credit card type and a number, checks that the number corresponds correctly with the type. |
void |
eliminateDuplicateFacets(SearchList searchList)
|
boolean |
isCreditCardValid(java.lang.String creditCardNumber)
Runs a given string through the Luhn algorithm to determine if it is a valid credit card number. |
boolean |
isInteger(java.lang.String value)
Checks to see if a given string is in the form of a valid integer. |
boolean |
isValidEmail(java.lang.String email)
Checks to see if a given string is in the form of a valid email address. |
boolean |
isValidPhone(java.lang.String phone)
Checks to see if a given string is in the form of a valid phone number. |
boolean |
isValidPostalCode(java.lang.String postalCode,
java.lang.String country)
Checks to see if a given string is in the form of a valid postal code, given an associated country. |
java.lang.String |
stringArrayAsURLParam(java.lang.String parameterName,
java.lang.String[] stringArray)
|
boolean |
stringArrayHasAnElement(BaseDynaForm form,
java.lang.String property)
Determines if at least one element was submitted and is of non-zero length for a string array parameter of a BaseDynaForm. |
boolean |
stringArrayHasAnElement(java.lang.String[] paramValues)
Determines if a given string array has at least one element and that it's of non-zero length. |
boolean |
stringArrayValuesGreaterThan(BaseDynaForm form,
java.lang.String property,
int value)
Determines if at least one element was submitted and is greater than a given int for a string array parameter of a
BaseDynaForm. |
boolean |
stringArrayValuesGreaterThan(java.lang.String[] paramValues,
int value)
Determines if at least one element in a string array is greater than a given value. |
boolean |
stringExists(BaseDynaForm form,
java.lang.String property)
Determines if a given parameter was included in the request for a BaseDynaForm and is of non-zero length. |
boolean |
stringValueGreaterThan(BaseDynaForm form,
java.lang.String property,
int value)
Determines if a given parameter for a BaseDynaForm is
greater than a given int. |
boolean |
stringValueLessThan(BaseDynaForm form,
java.lang.String property,
int value)
Determines if a given parameter for a BaseDynaForm is less
than a given int. |
boolean |
twoPropertiesEqual(BaseDynaForm form,
java.lang.String property1,
java.lang.String property2)
Determines if two string parameters submitted to a BaseDynaForm exist and are equal. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
static org.apache.commons.logging.Log log
| Constructor Detail |
|---|
public FormUtilsImpl()
| Method Detail |
|---|
public boolean stringExists(BaseDynaForm form,
java.lang.String property)
FormUtilsBaseDynaForm and is of non-zero length.
stringExists in interface FormUtilsform - The BaseDynaForm being processed.property - The name of the parameter being tested.
true if the given parameter was submitted to the
form and is of non-zero length. false if not.
public boolean twoPropertiesEqual(BaseDynaForm form,
java.lang.String property1,
java.lang.String property2)
FormUtilsBaseDynaForm exist and are equal.
twoPropertiesEqual in interface FormUtilsform - The BaseDynaForm being processed.property1 - The first parameter to be tested.property2 - The second parameter to be tested.
true if the given parameters were submitted to the
form and are equal. false if not.
public boolean stringValueGreaterThan(BaseDynaForm form,
java.lang.String property,
int value)
FormUtilsBaseDynaForm is
greater than a given int.
stringValueGreaterThan in interface FormUtilsform - The BaseDynaForm being processed.property - The name of the parameter to be tested.value - The value for the parameter to be tested against.
true if the given parameter is greater than the
value. false if not.
public boolean stringValueLessThan(BaseDynaForm form,
java.lang.String property,
int value)
FormUtilsBaseDynaForm is less
than a given int.
stringValueLessThan in interface FormUtilsform - The BaseDynaForm being processed.property - The name of the parameter to be tested.value - The value for the parameter to be tested against.
true if the given parameter is less than the
value. false if not.
public boolean stringArrayHasAnElement(BaseDynaForm form,
java.lang.String property)
FormUtilsBaseDynaForm.
stringArrayHasAnElement in interface FormUtilsform - The BaseDynaForm being processed.property - The name of the parameter being tested.
true if the given parameter has at least one
element and is of non-zero length. false if not.
public boolean stringArrayValuesGreaterThan(BaseDynaForm form,
java.lang.String property,
int value)
FormUtilsint for a string array parameter of a
BaseDynaForm.
stringArrayValuesGreaterThan in interface FormUtilsform - The BaseDynaForm being processed.property - The name of the parameter being tested.value - The value for the parameter to be tested against.
true if the given parameter has at least one
element and is greater than the value. false if
not.public boolean stringArrayHasAnElement(java.lang.String[] paramValues)
FormUtils
stringArrayHasAnElement in interface FormUtilsparamValues - The string array being tested.
true if the given string array has one element
that's of non-zero length.
public boolean stringArrayValuesGreaterThan(java.lang.String[] paramValues,
int value)
FormUtils
stringArrayValuesGreaterThan in interface FormUtilsparamValues - The string array being tested.value - The value for the string array's elements to be tested
against.
true if at least one element in a string array is
greater than a given value. false if not.public java.lang.String capitalize(java.lang.String stringToCapitalize)
FormUtils
capitalize in interface FormUtilsstringToCapitalize - The string to capitalize.
public boolean isValidEmail(java.lang.String email)
FormUtils.+@.+\\.[a-z]+
isValidEmail in interface FormUtilsemail - The string to be tested.
true if the given string matches a valid email
address.public boolean isValidPhone(java.lang.String phone)
FormUtils
isValidPhone in interface FormUtilsphone - The string to be tested.
true if the given string matches a valid phone
number.
public boolean isValidPostalCode(java.lang.String postalCode,
java.lang.String country)
FormUtils
isValidPostalCode in interface FormUtilspostalCode - The string to be tested.
true if the given string matches a valid postal
code.public boolean isInteger(java.lang.String value)
FormUtils
isInteger in interface FormUtilsvalue - The string to be tested.
true if the given string is a valid integerpublic boolean isCreditCardValid(java.lang.String creditCardNumber)
FormUtils
isCreditCardValid in interface FormUtilscreditCardNumber - The credit card number
public boolean doCardTypeAndNumberMatch(java.lang.String type,
java.lang.String number)
FormUtils
doCardTypeAndNumberMatch in interface FormUtilstype - Four types supported: "VISA", "DISCOVER", "AMEX", and
"MASTERCARD"number - The credit card number
public java.lang.String deriveCardType(java.lang.String number)
FormUtils
deriveCardType in interface FormUtilsnumber - The credit card number
public java.lang.Character containsCharacter(java.lang.String string,
java.lang.String characters)
FormUtils
containsCharacter in interface FormUtilsstring - The string to check againstcharacters - A String containing each of the characters to check
public java.lang.String stringArrayAsURLParam(java.lang.String parameterName,
java.lang.String[] stringArray)
throws java.lang.Exception
stringArrayAsURLParam in interface FormUtilsjava.lang.Exceptionpublic void eliminateDuplicateFacets(SearchList searchList)
eliminateDuplicateFacets in interface FormUtils
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||