public class DurationRecord extends RecordWrapper
Modifier and Type | Field and Description |
---|---|
static String |
DAYS
Property name of days field.
|
static String |
DURATION_TYPE
A full type name of core::Duration type.
|
static String |
HOURS
Property name of hours field.
|
static String |
MILLIS
Property name of millis field.
|
static String |
MINUTES
Property name of minutes field.
|
static String |
MONTHS
Property name of months field.
|
static String |
SECONDS
Property name of seconds field.
|
static String |
WEEKS
Property name of weeks field.
|
static 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 |
---|---|
Date |
addTo(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.
|
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.
|
Date |
subtractFrom(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 String DURATION_TYPE
public static final String YEARS
public static final String MONTHS
public static final String WEEKS
public static final String DAYS
public static final String HOURS
public static final String MINUTES
public static final String SECONDS
public static final String MILLIS
public DurationRecord()
public DurationRecord(RecordHolder holder)
holder
- public DurationRecord(long months, long millis)
months
- millis
- public 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 Date addTo(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 Date subtractFrom(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.