public class DurationRecord extends RecordWrapper
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DAYS
Property name of days field.
|
static java.lang.String |
DURATION_TYPE
A full type name of core::Duration type.
|
static java.lang.String |
HOURS
Property name of hours field.
|
static java.lang.String |
MILLIS
Property name of millis field.
|
static java.lang.String |
MINUTES
Property name of minutes field.
|
static java.lang.String |
MONTHS
Property name of months field.
|
static java.lang.String |
SECONDS
Property name of seconds field.
|
static java.lang.String |
WEEKS
Property name of weeks field.
|
static java.lang.String |
YEARS
Property name of years field.
|
Constructor and Description |
---|
DurationRecord()
Creates a new record wrapper instance with no record holder.
|
DurationRecord(long months,
long millis)
Creates a new duration with a given number of months
and milliseconds.
|
DurationRecord(RecordHolder holder)
Creates a new record wrapper instance.
|
Modifier and Type | Method and Description |
---|---|
java.util.Date |
addTo(java.util.Date date)
Returns a date equal to
date - duration . |
java.time.LocalDate |
addTo(java.time.LocalDate date)
Returns a date equal to
date + duration . |
java.time.LocalDateTime |
addTo(java.time.LocalDateTime date)
Returns a date equal to
date + duration . |
int |
getDays()
Returns the days property.
|
Decimal |
getDaysDecimal()
Returns the days property.
|
int |
getHours()
Returns the hours property.
|
Decimal |
getHoursDecimal()
Returns the hours property.
|
int |
getMillis()
Returns the millis property.
|
Decimal |
getMillisDecimal()
Returns the millis property.
|
int |
getMinutes()
Returns the minutes property.
|
Decimal |
getMinutesDecimal()
Returns the minutes property.
|
int |
getMonths()
Returns the months property.
|
Decimal |
getMonthsDecimal()
Returns the months property.
|
int |
getSeconds()
Returns the seconds property.
|
Decimal |
getSecondsDecimal()
Returns the seconds property.
|
long |
getTotalMillis()
Gets the total milliseconds in this duration.
|
long |
getTotalMonths()
Gets the total number of months in this duration.
|
java.lang.String |
getTypeName()
Returns the full type name of the record.
|
int |
getWeeks()
Returns the weeks property.
|
Decimal |
getWeeksDecimal()
Returns the weeks property.
|
int |
getYears()
Returns the years property.
|
Decimal |
getYearsDecimal()
Returns the years property.
|
boolean |
isDayTimeDuration()
Returns
true if the duration contains
only weeks, days and time components. |
boolean |
isYearMonthDuration()
Returns
true if the duration contains
only years and months components. |
DurationRecord |
minus(DurationRecord d)
Creates a new duration by subtract a given duration from this.
|
DurationRecord |
plus(DurationRecord d)
Creates a new duration by adding this and a given duration.
|
void |
setDays(Decimal days)
Sets the days property.
|
void |
setDays(int days)
Sets the days property.
|
void |
setHours(Decimal hours)
Sets the hours property.
|
void |
setHours(int hours)
Sets the hours property.
|
void |
setMillis(Decimal millis)
Sets the millis property.
|
void |
setMillis(int millis)
Sets the millis property.
|
void |
setMinutes(Decimal minutes)
Sets the minutes property.
|
void |
setMinutes(int minutes)
Sets the minutes property.
|
void |
setMonths(Decimal months)
Sets the months property.
|
void |
setMonths(int months)
Sets the months property.
|
void |
setSeconds(Decimal seconds)
Sets the seconds property.
|
void |
setSeconds(int seconds)
Sets the seconds property.
|
void |
setWeeks(Decimal weeks)
Sets the weeks property.
|
void |
setWeeks(int weeks)
Sets the weeks property.
|
void |
setYears(Decimal years)
Sets the years property.
|
void |
setYears(int years)
Sets the years property.
|
java.util.Date |
subtractFrom(java.util.Date date)
Returns a date equal to
date - duration . |
java.time.LocalDate |
subtractFrom(java.time.LocalDate date)
Returns a date equal to
date - duration . |
java.time.LocalDateTime |
subtractFrom(java.time.LocalDateTime date)
Returns a date equal to
date - duration . |
asMap, create, equals, getIntProperty, getProperty, hashCode, holder, isCreated, setIntProperty, setProperty, toCollection, toList, toSet, toString, unwrap
public static final java.lang.String DURATION_TYPE
public static final java.lang.String YEARS
public static final java.lang.String MONTHS
public static final java.lang.String WEEKS
public static final java.lang.String DAYS
public static final java.lang.String HOURS
public static final java.lang.String MINUTES
public static final java.lang.String SECONDS
public static final java.lang.String MILLIS
public DurationRecord()
public DurationRecord(RecordHolder holder)
holder
- public DurationRecord(long months, long millis)
months
- millis
- public java.lang.String getTypeName()
IRecordWrapper
getTypeName
in interface IRecordWrapper
getTypeName
in class RecordWrapper
public int getYears()
public Decimal getYearsDecimal()
public void setYears(int years)
years
- public void setYears(Decimal years)
years
- public int getMonths()
public Decimal getMonthsDecimal()
public void setMonths(int months)
months
- public void setMonths(Decimal months)
months
- public int getWeeks()
public Decimal getWeeksDecimal()
public void setWeeks(int weeks)
weeks
- public void setWeeks(Decimal weeks)
weeks
- public int getDays()
public Decimal getDaysDecimal()
public void setDays(int days)
days
- public void setDays(Decimal days)
days
- public int getHours()
public Decimal getHoursDecimal()
public void setHours(int hours)
hours
- public void setHours(Decimal hours)
hours
- public int getMinutes()
public Decimal getMinutesDecimal()
public void setMinutes(int minutes)
minutes
- public void setMinutes(Decimal minutes)
minutes
- public int getSeconds()
public Decimal getSecondsDecimal()
public void setSeconds(int seconds)
seconds
- public void setSeconds(Decimal seconds)
seconds
- public int getMillis()
public Decimal getMillisDecimal()
public void setMillis(int millis)
millis
- public void setMillis(Decimal millis)
millis
- public boolean isYearMonthDuration()
true
if the duration contains
only years and months components.true
if the duration is "yearMonthDuration"public long getTotalMonths()
public boolean isDayTimeDuration()
true
if the duration contains
only weeks, days and time components.true
if the duration is "dayTimeDuration"public long getTotalMillis()
public DurationRecord plus(DurationRecord d)
d
- public DurationRecord minus(DurationRecord d)
d
- public java.util.Date addTo(java.util.Date date)
date - duration
.date
- date - duration
public java.time.LocalDate addTo(java.time.LocalDate date)
date + duration
.date
- date + duration
public java.time.LocalDateTime addTo(java.time.LocalDateTime date)
date + duration
.date
- date + duration
public java.util.Date subtractFrom(java.util.Date date)
date - duration
.date
- date - duration
public java.time.LocalDate subtractFrom(java.time.LocalDate date)
date - duration
.date
- date - duration
public java.time.LocalDateTime subtractFrom(java.time.LocalDateTime date)
date - duration
.date
- date - duration
Copyright © 2007-2020 Whitestein Technologies. All Rights Reserved.