@Embeddable
@MappedSuperclass
public class TimePeriod
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static org.joda.time.Partial |
CONTINUED |
static org.joda.time.DateTimeFieldType |
DAY_TYPE |
static org.joda.time.DateTimeFieldType |
HOUR_TYPE |
static org.joda.time.DateTimeFieldType |
MINUTE_TYPE |
static org.joda.time.DateTimeFieldType |
MONTH_TYPE |
static org.joda.time.DateTimeFieldType |
YEAR_TYPE |
Modifier | Constructor and Description |
---|---|
protected |
TimePeriod()
Constructor
|
|
TimePeriod(org.joda.time.Partial startDate) |
|
TimePeriod(org.joda.time.Partial startDate,
org.joda.time.Partial endDate) |
Modifier and Type | Method and Description |
---|---|
static org.joda.time.Partial |
calendarToPartial(java.util.Calendar calendar)
Transforms a
Calendar into a Partial |
java.lang.Object |
clone() |
protected static void |
copyCloned(TimePeriod origin,
TimePeriod target) |
boolean |
equals(java.lang.Object obj) |
static TimePeriod |
fromVerbatim(VerbatimTimePeriod verbatimTimePeriod) |
org.joda.time.Partial |
getEnd() |
java.lang.Integer |
getEndDay() |
java.lang.Integer |
getEndMonth() |
java.lang.Integer |
getEndYear() |
java.lang.String |
getFreeText()
For time periods that need to store more information than the one
that can be stored in
start and end . |
static java.lang.Integer |
getPartialValue(org.joda.time.Partial partial,
org.joda.time.DateTimeFieldType type) |
org.joda.time.Partial |
getStart() |
java.lang.Integer |
getStartDay() |
java.lang.Integer |
getStartMonth() |
java.lang.Integer |
getStartYear() |
java.lang.String |
getTimePeriod()
Returns the concatenation of
start and end |
java.lang.String |
getYear() |
int |
hashCode() |
boolean |
isContinued()
Returns the continued flag (internally stored as a constant
far away date.
|
boolean |
isEmpty()
True, if there is no start date and no end date and no freetext representation exists.
|
boolean |
isPeriod()
True, if this time period represents a period not a single point in time.
|
static TimePeriod |
NewInstance()
Factory method
|
static TimePeriod |
NewInstance(java.util.Calendar startCalendar)
Factory method to create a TimePeriod from a
Calendar . |
static TimePeriod |
NewInstance(java.util.Calendar startCalendar,
java.util.Calendar endCalendar)
Factory method to create a TimePeriod from a starting and an ending
Calendar |
static TimePeriod |
NewInstance(java.util.Date startDate,
java.util.Date endDate)
Factory method to create a TimePeriod from a starting and an ending
Date |
static TimePeriod |
NewInstance(java.lang.Integer year)
Factory method
|
static TimePeriod |
NewInstance(java.lang.Integer startYear,
java.lang.Integer endYear)
Factory method
|
static TimePeriod |
NewInstance(org.joda.time.Partial startDate)
Factory method
|
static TimePeriod |
NewInstance(org.joda.time.Partial startDate,
org.joda.time.Partial endDate)
Factory method
|
static TimePeriod |
NewInstance(org.joda.time.ReadableInstant readableInstant)
Factory method to create a TimePeriod from a
ReadableInstant (e.g. |
static TimePeriod |
NewInstance(org.joda.time.ReadableInstant startInstant,
org.joda.time.ReadableInstant endInstant)
Factory method to create a TimePeriod from a starting and an ending
ReadableInstant (e.g. |
static org.joda.time.Partial |
readableInstantToPartial(org.joda.time.ReadableInstant readableInstant)
Transforms a
ReadableInstant into a Partial |
void |
setContinued(boolean isContinued)
Sets the (virtual) continued flag.
NOTE: setting the flag to true, will remove an existing end date. |
void |
setEnd(org.joda.time.Partial end) |
TimePeriod |
setEndDay(java.lang.Integer day) |
TimePeriod |
setEndMonth(java.lang.Integer month) |
TimePeriod |
setEndYear(java.lang.Integer year) |
void |
setFreeText(java.lang.String freeText)
Use
#parseSingleDate(String) for public use. |
static org.joda.time.Partial |
setPartialField(org.joda.time.Partial partial,
java.lang.Integer value,
org.joda.time.DateTimeFieldType type) |
void |
setStart(org.joda.time.Partial start) |
TimePeriod |
setStartDay(java.lang.Integer day) |
TimePeriod |
setStartMonth(java.lang.Integer month) |
TimePeriod |
setStartYear(java.lang.Integer year) |
java.lang.String |
toString()
Returns the
getFreeText() value if free text is not null . |
VerbatimTimePeriod |
toVerbatim() |
static VerbatimTimePeriod |
toVerbatim(TimePeriod timePeriod) |
public static final org.joda.time.DateTimeFieldType YEAR_TYPE
public static final org.joda.time.DateTimeFieldType MONTH_TYPE
public static final org.joda.time.DateTimeFieldType DAY_TYPE
public static final org.joda.time.DateTimeFieldType HOUR_TYPE
public static final org.joda.time.DateTimeFieldType MINUTE_TYPE
public static final org.joda.time.Partial CONTINUED
protected TimePeriod()
public TimePeriod(org.joda.time.Partial startDate)
public TimePeriod(org.joda.time.Partial startDate, org.joda.time.Partial endDate)
public static final TimePeriod NewInstance()
public static final TimePeriod NewInstance(org.joda.time.Partial startDate)
public static final TimePeriod NewInstance(org.joda.time.Partial startDate, org.joda.time.Partial endDate)
public static final TimePeriod NewInstance(java.lang.Integer year)
public static final TimePeriod NewInstance(java.lang.Integer startYear, java.lang.Integer endYear)
public static final TimePeriod NewInstance(java.util.Calendar startCalendar)
Calendar
. The Calendar is stored as the starting instant.public static final TimePeriod NewInstance(org.joda.time.ReadableInstant readableInstant)
ReadableInstant
(e.g. DateTime
).
The ReadableInstant
is stored as the starting instant.public static final TimePeriod NewInstance(java.util.Calendar startCalendar, java.util.Calendar endCalendar)
Calendar
public static final TimePeriod NewInstance(java.util.Date startDate, java.util.Date endDate)
Date
public static final TimePeriod NewInstance(org.joda.time.ReadableInstant startInstant, org.joda.time.ReadableInstant endInstant)
ReadableInstant
(e.g. DateTime
)public static org.joda.time.Partial calendarToPartial(java.util.Calendar calendar)
Calendar
into a Partial
calendar
- public static org.joda.time.Partial readableInstantToPartial(org.joda.time.ReadableInstant readableInstant)
ReadableInstant
into a Partial
calendar
- public static java.lang.Integer getPartialValue(org.joda.time.Partial partial, org.joda.time.DateTimeFieldType type)
public static TimePeriod fromVerbatim(VerbatimTimePeriod verbatimTimePeriod)
public static VerbatimTimePeriod toVerbatim(TimePeriod timePeriod)
public VerbatimTimePeriod toVerbatim()
public org.joda.time.Partial getStart()
public void setStart(org.joda.time.Partial start)
public org.joda.time.Partial getEnd()
public void setEnd(org.joda.time.Partial end)
public java.lang.String getFreeText()
start
and end
.
If free text is not null toString()
will always
return the free text value.
Use toString()
for public use.
public void setFreeText(java.lang.String freeText)
#parseSingleDate(String)
for public use.freeText
- the freeText to setpublic boolean isContinued()
CONTINUED
public void setContinued(boolean isContinued)
isContinued
- public boolean isPeriod()
public boolean isEmpty()
public java.lang.Integer getStartYear()
public java.lang.Integer getStartMonth()
public java.lang.Integer getStartDay()
public java.lang.Integer getEndYear()
public java.lang.Integer getEndMonth()
public java.lang.Integer getEndDay()
public TimePeriod setStartYear(java.lang.Integer year)
public TimePeriod setStartMonth(java.lang.Integer month) throws java.lang.IndexOutOfBoundsException
java.lang.IndexOutOfBoundsException
public TimePeriod setStartDay(java.lang.Integer day) throws java.lang.IndexOutOfBoundsException
java.lang.IndexOutOfBoundsException
public TimePeriod setEndYear(java.lang.Integer year)
public TimePeriod setEndMonth(java.lang.Integer month) throws java.lang.IndexOutOfBoundsException
java.lang.IndexOutOfBoundsException
public TimePeriod setEndDay(java.lang.Integer day) throws java.lang.IndexOutOfBoundsException
java.lang.IndexOutOfBoundsException
public static org.joda.time.Partial setPartialField(org.joda.time.Partial partial, java.lang.Integer value, org.joda.time.DateTimeFieldType type) throws java.lang.IndexOutOfBoundsException
java.lang.IndexOutOfBoundsException
public java.lang.String toString()
getFreeText()
value if free text is not null
.
Otherwise the concatenation of start
and end
is returned.toString
in class java.lang.Object
Object.toString()
public java.lang.String getTimePeriod()
start
and end
public java.lang.String getYear()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.Object clone()
clone
in class java.lang.Object
protected static void copyCloned(TimePeriod origin, TimePeriod target)
result
- Copyright © 2007-2020 EDIT. All Rights Reserved.