public class DateValue extends Object implements Comparable<DateValue>, DateValueContainer
Constructor and Description |
---|
DateValue(Date date)
Constructor.
|
DateValue(int year,
int month,
int dayOfTheMonth)
Constructor.
|
DateValue(String date)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(DateValue other) |
boolean |
equals(Object obj) |
static DateValue |
from(Date date)
Makes an instance of date value from a
Date . |
DateValue |
getDate()
Returns the date.
|
int |
getDayOfTheMonth()
Returns the day of the month.
|
int |
getMonth()
Returns the month.
|
int |
getYear()
Returns the year.
|
int |
hashCode() |
boolean |
isAfter(DateValue date)
Returns if this date value is after the date value in parameter.
|
boolean |
isBefore(DateValue date)
Returns if this date value is before the date value in parameter.
|
boolean |
isMidnight()
Returns if it is midnight.
|
static DateValue |
of(int year,
int month,
int dayOfTheMonth)
Makes an instance of date value from a day of month, a month and an year.
|
static DateValue |
parse(String date)
Makes an instance of date value from a
String in format yyyy-mm-dd . |
String |
toString() |
public DateValue(int year, int month, int dayOfTheMonth)
year
- Year.month
- Month.dayOfTheMonth
- Day of the month.public DateValue(String date) throws ParseException
date
- Date in String
format (yyyy-mm-dd
).NullPointerException
- If date
is null
.ParseException
- If date
don't respect the yyyy-mm-dd
format.public DateValue(Date date)
date
- Date.NullPointerException
- If date
is null
.public static DateValue of(int year, int month, int dayOfTheMonth)
year
- Year.month
- Month.dayOfTheMonth
- Day of the month.public static DateValue parse(String date) throws ParseException
String
in format yyyy-mm-dd
.date
- Date in String
format (yyyy-mm-dd
).NullPointerException
- If date
is null
.ParseException
- If date
don't respect the yyyy-mm-dd
format.public static DateValue from(Date date)
Date
.date
- Date.NullPointerException
- If date
is null
.public DateValue getDate()
getDate
in interface DateValueContainer
public boolean isMidnight()
DateValueContainer
isMidnight
in interface DateValueContainer
true
if it is midnight.public int getDayOfTheMonth()
public int getMonth()
public int getYear()
public int compareTo(DateValue other)
compareTo
in interface Comparable<DateValue>
public boolean isBefore(DateValue date)
date
- The date value to compare to.public boolean isAfter(DateValue date)
date
- The date value to compare to.Copyright © 2015 AssertJ. All Rights Reserved.