Methods Summary |
---|
public java.lang.String | getBirthDate()Returns the birthDate property value
return (birthDate == null ? "" : birthDate);
|
public java.lang.String | getBirthDateFormatted()Returns the birthDate property value,
with all HTML special characters converted
to HTML character entities
return StringFormat.toHTMLString(getBirthDate());
|
public java.lang.String | getEmailAddr()Returns the emailAddr property value
return (emailAddr == null ? "" : emailAddr);
|
public java.lang.String | getEmailAddrFormatted()Returns the emailAddr property value,
with all HTML special characters converted
to HTML character entities
return StringFormat.toHTMLString(getEmailAddr());
|
public java.lang.String[] | getInterests()Returns the interests property value
return interests;
|
public java.lang.String[] | getInterestsFormatted()Returns the interests property value,
with all HTML special characters converted
to HTML character entities
String[] formatted = null;
String[] interests = getInterests();
if (interests != null) {
formatted = new String[interests.length];
for (int i = 0; i < interests.length; i++) {
formatted[i] = StringFormat.toHTMLString(interests[i]);
}
}
return formatted;
|
public java.lang.String | getLuckyNumber()Returns the luckyNumber property value
return (luckyNumber == null ? "" : luckyNumber);
|
public java.lang.String | getLuckyNumberFormatted()Returns the luckyNumber property value,
with all HTML special characters converted
to HTML character entities
return StringFormat.toHTMLString(getLuckyNumber());
|
public java.lang.String | getPropertyStatusMsg()Returns an HTML fragment with information about
all invalid property values, or an empty String
if all properties are valid.
StringBuffer msg = new StringBuffer();
if (!isInitialized()) {
msg.append("Please enter values in all fields");
}
else if (!isValid()) {
msg.append("The following values are missing or invalid: ");
msg.append("<ul>");
if (birthDate == null) {
if (birthDateInput == null) {
msg.append("<li>Birth date is missing");
}
else {
msg.append("<li>Birth date value is invalid: " + birthDateInput);
}
}
if (emailAddr == null) {
if (emailAddrInput == null) {
msg.append("<li>Email address is missing");
}
else {
msg.append("<li>Email address value is invalid: " + emailAddrInput);
}
}
if (luckyNumber == null) {
if (luckyNumberInput == null) {
msg.append("<li>Lucky number is missing");
}
else {
msg.append("<li>Lucky number value is invalid: " + luckyNumberInput);
}
}
if (sex == null) {
if (sexInput == null) {
msg.append("<li>Sex is missing");
}
else {
msg.append("<li>Sex value is invalid: " + sexInput);
}
}
if (userName == null) {
msg.append("<li>User name is missing");
}
msg.append("</ul>");
msg.append("Please enter new valid values");
}
else {
msg.append("Thanks for telling us about yourself!");
}
return msg.toString();
|
public java.lang.String | getSex()Returns the sex property value
return (sex == null ? "" : sex);
|
public java.lang.String | getSexFormatted()Returns the sex property value,
with all HTML special characters converted
to HTML character entities
return StringFormat.toHTMLString(getSex());
|
public java.lang.String | getUserName()Returns the userName property value
return (userName == null ? "" : userName);
|
public java.lang.String | getUserNameFormatted()Returns the userName property value,
with all HTML special characters converted
to HTML character entities
return StringFormat.toHTMLString(getUserName());
|
private boolean | isInitialized()Returns true if at least one property has been set
return isInitialized;
|
public boolean | isValid()Returns true if all property values have valid values
(they are only set if the value is valid).
return isInitialized() &&
birthDate != null &&
emailAddr != null &&
luckyNumber != null &&
sex != null &&
userName != null;
|
public void | setBirthDate(java.lang.String birthDate)Sets the birthDate property value, if it's
valid
isInitialized = true;
birthDateInput = birthDate;
if (StringFormat.isValidDate(birthDate, DATE_FORMAT_PATTERN)) {
this.birthDate = birthDate;
}
|
public void | setEmailAddr(java.lang.String emailAddr)Sets the emailAddr property value, if it's
valid
isInitialized = true;
emailAddrInput = emailAddr;
if (StringFormat.isValidEmailAddr(emailAddr)) {
this.emailAddr = emailAddr;
}
|
public void | setInterests(java.lang.String[] interests)Sets the interests property value
this.interests = interests;
|
public void | setLuckyNumber(java.lang.String luckyNumber)Sets the luckyNumber property value, if it's
valid
isInitialized = true;
luckyNumberInput = luckyNumber;
if (StringFormat.isValidInteger(luckyNumber, MIN_LUCKY_NUMBER,
MAX_LUCKY_NUMBER)) {
this.luckyNumber = luckyNumber;
}
|
public void | setSex(java.lang.String sex)Sets the sex property value, if it's
valid
isInitialized = true;
sexInput = sex;
if (StringFormat.isValidString(sex, SEX_LIST, true)) {
this.sex = sex;
}
|
public void | setUserName(java.lang.String userName)Sets the userName property value
isInitialized = true;
this.userName = userName;
|