Package be.gaudry.model.edu
Class Period
java.lang.Object
be.gaudry.model.AbstractLightObject
be.gaudry.model.edu.Period
- All Implemented Interfaces:
IPeriod,ILightObject,Serializable
- Direct Known Subclasses:
SchoolYear
- Since:
- 1.0 Oct 12, 2008
- Author:
- Steph GAUDRY
- See Also:
- Serialized Form
-
Field Summary
FieldsFields inherited from interface be.gaudry.model.ILightObject
DEFAULT_ID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck if a given date is between the period start (excluded) and the period end (excluded).
If you want to know if a date match including the start and end dates, you may do like that:booleancontainsEndInclude(Date date)Check if a given date is between the period start (excluded) and the period end (included).booleancontainsStartInclude(Date date)Check if a given date is between the period start (included) and the period end (excluded).Returns a formated String with the interval between the start date and end date; or a custom display if thesetDisplay(String)has been called.The date when theIPeriodstops.intgetId()Identifier of the ILightObjectThe date when theIPeriodstarts.voidsetDisplay(String display)Sets the display.voidsetEndDate(Date endDate)voidsetId(int id)voidsetParentPeriod(Period parentPeriod)voidsetStartDate(Date startDate)toString()Builds a string with variables values and the class.Methods inherited from class be.gaudry.model.AbstractLightObject
equals, hashCode
-
Field Details
-
defaultPeriod
-
-
Constructor Details
-
Period
public Period() -
Period
- Parameters:
id-display-
-
Period
- Parameters:
startDate-endDate-
-
-
Method Details
-
contains
Check if a given date is between the period start (excluded) and the period end (excluded).
If you want to know if a date match including the start and end dates, you may do like that:if (date.equals(period.getStartDate()) || date.equals(period.getEndDate())) { return true; }else{ return period.contains(date); }- Parameters:
date- date to check- Returns:
- true if the given date is included into this
Period
-
containsEndInclude
Check if a given date is between the period start (excluded) and the period end (included).- Parameters:
date- date to check- Returns:
-
containsStartInclude
Check if a given date is between the period start (included) and the period end (excluded).- Parameters:
date- date to check- Returns:
-
getStartDate
Description copied from interface:IPeriodThe date when theIPeriodstarts.- Specified by:
getStartDatein interfaceIPeriod- Returns:
- the startDate
-
setStartDate
- Specified by:
setStartDatein interfaceIPeriod- Parameters:
startDate- the startDate to set- See Also:
IPeriod.getStartDate()
-
getEndDate
Description copied from interface:IPeriodThe date when theIPeriodstops.- Specified by:
getEndDatein interfaceIPeriod- Returns:
- the endDate
-
setEndDate
- Specified by:
setEndDatein interfaceIPeriod- Parameters:
endDate- the endDate to set- See Also:
IPeriod.getEndDate()
-
getParentPeriod
- Returns:
- the parentPeriod
-
setParentPeriod
- Parameters:
parentPeriod- the parentPeriod to set
-
toString
Description copied from class:AbstractLightObjectBuilds a string with variables values and the class.- Overrides:
toStringin classAbstractLightObject- Returns:
- a String representation of this LightObject only for debugging
- See Also:
getIntervalString()
-
getIntervalString
- Specified by:
getIntervalStringin interfaceIPeriod- Returns:
- the
IPeriodString representation
-
getId
public int getId()Description copied from interface:ILightObjectIdentifier of the ILightObject- Specified by:
getIdin interfaceILightObject- Returns:
- the id
-
setId
public void setId(int id)- Specified by:
setIdin interfaceILightObject- Parameters:
id- the id to set- See Also:
ILightObject.getId()
-
getDisplay
Returns a formated String with the interval between the start date and end date; or a custom display if thesetDisplay(String)has been called.- Specified by:
getDisplayin interfaceILightObject- Returns:
- the display
- See Also:
ILightObject.getDisplay()
-
setDisplay
Sets the display. This means that the default view is no longer the interval between the start date and end date, but the display parameter. \nSets the display. \nThis general contract does not guarantee that theILightObject.getDisplay()method will return the same string as the display argument. \nIn many subclasses of the basic implementationAbstractLightObject, theILightObject.getDisplay()method returns a String built from a few meaningful properties. Thus, setting the display must be implemented in a way to respect the inheritance principle; the subclass behavior must be the same as expected from the supertype. \nBe careful than overriding this may produces side effects because setting the display may affects other properties. \nA good way is overriding the GenericLightObjectTest<T> class to test this. \n\nMaven dependency for the the GenericLightObjectTest<T>:- groupId: be.gaudry.broldev
- artifactId: broldev.core.jpa-tests
- Specified by:
setDisplayin interfaceILightObject- Parameters:
display- String representation of the object- See Also:
ILightObject.setDisplay(java.lang.String)
-