public class DateOfBirth
extends java.lang.Object
Constructor and Description |
---|
DateOfBirth()
Default constructor.
|
DateOfBirth(java.util.Date dob)
Constructor by Date object.
|
DateOfBirth(int year,
int month,
int day)
Constructor by year, month and day.
|
DateOfBirth(java.sql.Timestamp dob)
Constructor by Timestamp object.
|
Modifier and Type | Method and Description |
---|---|
int |
getAge()
Get the age based in the Date of Birth.
|
java.lang.String |
getAgeRange()
Gets the age range from the Date of Birth.
|
java.lang.String |
getCategory()
Gets the category based on the age group.
|
java.util.Date |
getDate()
Get the Date of Birth as Date object.
|
java.lang.String |
getDayOfWeek()
Get the Day of Week from the Date of Birth based in the system configuration.
|
java.time.LocalDate |
getLocalDate()
Get the Date of Birth as LocalDate object.
|
java.lang.String |
getMonth()
Get the text of the month from the Date of Birth based in the system configuration.
|
java.sql.Timestamp |
getTimestamp()
Get the Date of Birth as Timestamp object.
|
boolean |
isAdult()
Indicates if the age group belongs to an adult.
|
boolean |
isChild()
Indicates if the age group belongs to a child.
|
boolean |
isNewborn()
Indicates if the age group belongs to a new born.
|
boolean |
isSenior()
Indicates if the age group belongs to a senior.
|
boolean |
isTeen()
Indicates if the age group belongs to a teenager.
|
boolean |
isWeekend()
Indicates if the Date of Birth falls in a weekend.
|
java.lang.String |
toString() |
public DateOfBirth()
public DateOfBirth(int year, int month, int day)
year
- Year to set in the Date of Birth.month
- Month to set in the Date of Birth.day
- Day of the month to set in the Date of Birth.public DateOfBirth(java.util.Date dob)
dob
- Date object representing the Date of Birth.Date
public DateOfBirth(java.sql.Timestamp dob)
dob
- Timestamp object representing the Date of Birth.Timestamp
public java.util.Date getDate()
Date
public java.sql.Timestamp getTimestamp()
Timestamp
public java.time.LocalDate getLocalDate()
LocalDate
public int getAge()
public java.lang.String getMonth()
public java.lang.String getDayOfWeek()
public boolean isWeekend()
public boolean isNewborn()
public boolean isChild()
public boolean isTeen()
public boolean isAdult()
public boolean isSenior()
public java.lang.String getCategory()
public java.lang.String getAgeRange()
public java.lang.String toString()
toString
in class java.lang.Object