com.silverpeas.calendar
Class AbstractDateDatable<T extends Datable<? super T>>

java.lang.Object
  extended by java.util.Date
      extended by com.silverpeas.calendar.AbstractDateDatable<T>
All Implemented Interfaces:
Datable<T>, Serializable, Cloneable, Comparable<Date>
Direct Known Subclasses:
Date, DateTime

public abstract class AbstractDateDatable<T extends Datable<? super T>>
extends Date
implements Datable<T>

User: Yohann Chastagnier Date: 06/12/13

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface com.silverpeas.calendar.Datable
ICAL_PATTERN, ICAL_UTC_PATTERN, ISO_8601_PATTERN, SHORT_ISO_8601_PATTERN
 
Constructor Summary
AbstractDateDatable(long date)
          Default constructor.
 
Method Summary
 T addDays(int amount)
          Adds a number of days to the datable instance returning a new one.
 T addHours(int amount)
          Adds a number of hours to the datable instance returning a new one.
 T addMilliseconds(int amount)
          Adds a number of milliseconds to the datable instance returning a new one.
 T addMinutes(int amount)
          Adds a number of minutes to the datable instance returning a new one.
 T addMonths(int amount)
          Adds a number of months to the datable instance returning a new one.
 T addSeconds(int amount)
          Adds a number of seconds to the datable instance returning a new one.
 T addWeeks(int amount)
          Adds a number of weeks to the datable instance returning a new one.
 T addYears(int amount)
          Adds a number of years to the datable instance returning a new one.
abstract  T clone()
          Clones itself.
 T getBeginOfDay()
          Computes first hour, minute, second, millisecond from the datable instance.
 T getBeginOfMonth()
          Compute the first hour, minute, second, millisecond from the datable instance.
 T getBeginOfWeek()
          Compute the first hour, minute, second, millisecond from the datable instance.
 T getBeginOfWeek(String locale)
          Compute the first hour, minute, second, millisecond from the datable instance and a given locale.
 T getBeginOfYear()
          Compute the first hour, minute, second, millisecond from the datable instance.
 T getEndOfDay()
          Computes first hour, minute, second, millisecond from the datable instance.
 T getEndOfMonth()
          Compute the date of the first day in the month from the datable instance.
 T getEndOfWeek()
          Compute the date of the first day in the week from the datable instance.
 T getEndOfWeek(String locale)
          Compute the date of the first day in the week from the datable instance and a given locale.
 T getEndOfYear()
          Compute the date of the first day in the year from the datable instance.
 TimeData getTimeDataTo(T anotherDatable)
          Compute the time between the datable instance and another one.
 boolean isDefined()
          Indicates is the date is different from DateUtil.MINIMUM_DATE or DateUtil.MAXIMUM_DATE.
 boolean isNotDefined()
          Indicates the opposite of Datable.isDefined()
protected abstract  T newInstanceFrom(Date aDate)
          Create a new instance from a given date time in milliseconds.
 
Methods inherited from class java.util.Date
after, before, compareTo, equals, getDate, getDay, getHours, getMinutes, getMonth, getSeconds, getTime, getTimezoneOffset, getYear, hashCode, parse, setDate, setHours, setMinutes, setMonth, setSeconds, setTime, setYear, toGMTString, toLocaleString, toString, UTC
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.silverpeas.calendar.Datable
asDate, getTimeZone, inTimeZone, isAfter, isBefore, isEqualTo, toICal, toICalInUTC, toISO8601, toShortISO8601
 

Constructor Detail

AbstractDateDatable

public AbstractDateDatable(long date)
Default constructor.

Parameters:
date -
Method Detail

clone

public abstract T clone()
Description copied from interface: Datable
Clones itself.

Specified by:
clone in interface Datable<T extends Datable<? super T>>
Overrides:
clone in class Date
Returns:
a clone to this datable.

getTimeDataTo

public TimeData getTimeDataTo(T anotherDatable)
Description copied from interface: Datable
Compute the time between the datable instance and another one.

Specified by:
getTimeDataTo in interface Datable<T extends Datable<? super T>>
Returns:
the time between the datable instance and another one represented by TimeData.

newInstanceFrom

protected abstract T newInstanceFrom(Date aDate)
Create a new instance from a given date time in milliseconds.

Parameters:
aDate - the date time in milliseconds.
Returns:
the new datable instance corresponding to the given time in milliseconds.

getBeginOfDay

public T getBeginOfDay()
Description copied from interface: Datable
Computes first hour, minute, second, millisecond from the datable instance.

Specified by:
getBeginOfDay in interface Datable<T extends Datable<? super T>>
Returns:
a date at last hour, minute, second and millisecond of the datable instance.

getEndOfDay

public T getEndOfDay()
Description copied from interface: Datable
Computes first hour, minute, second, millisecond from the datable instance.

Specified by:
getEndOfDay in interface Datable<T extends Datable<? super T>>
Returns:
a date at last hour, minute, second and millisecond of the datable instance.

getBeginOfWeek

public T getBeginOfWeek()
Description copied from interface: Datable
Compute the first hour, minute, second, millisecond from the datable instance.

Specified by:
getBeginOfWeek in interface Datable<T extends Datable<? super T>>
Returns:
a date at last hour, minute, second and millisecond of the datable instance.

getEndOfWeek

public T getEndOfWeek()
Description copied from interface: Datable
Compute the date of the first day in the week from the datable instance.

Specified by:
getEndOfWeek in interface Datable<T extends Datable<? super T>>
Returns:
a date for the first day of the week of the datable instance.

getBeginOfWeek

public T getBeginOfWeek(String locale)
Description copied from interface: Datable
Compute the first hour, minute, second, millisecond from the datable instance and a given locale.

Specified by:
getBeginOfWeek in interface Datable<T extends Datable<? super T>>
Returns:
a date at last hour, minute, second and millisecond of the datable instance.

getEndOfWeek

public T getEndOfWeek(String locale)
Description copied from interface: Datable
Compute the date of the first day in the week from the datable instance and a given locale.

Specified by:
getEndOfWeek in interface Datable<T extends Datable<? super T>>
Returns:
a date for the first day of the week of the datable instance.

getBeginOfMonth

public T getBeginOfMonth()
Description copied from interface: Datable
Compute the first hour, minute, second, millisecond from the datable instance.

Specified by:
getBeginOfMonth in interface Datable<T extends Datable<? super T>>
Returns:
a date at last hour, minute, second and millisecond of the datable instance.

getEndOfMonth

public T getEndOfMonth()
Description copied from interface: Datable
Compute the date of the first day in the month from the datable instance.

Specified by:
getEndOfMonth in interface Datable<T extends Datable<? super T>>
Returns:
a date for the first day of the month of the datable instance.

getBeginOfYear

public T getBeginOfYear()
Description copied from interface: Datable
Compute the first hour, minute, second, millisecond from the datable instance.

Specified by:
getBeginOfYear in interface Datable<T extends Datable<? super T>>
Returns:
a date at last hour, minute, second and millisecond of the datable instance.

getEndOfYear

public T getEndOfYear()
Description copied from interface: Datable
Compute the date of the first day in the year from the datable instance.

Specified by:
getEndOfYear in interface Datable<T extends Datable<? super T>>
Returns:
a date for the first day of the year of the datable instance.

addYears

public T addYears(int amount)
Description copied from interface: Datable
Adds a number of years to the datable instance returning a new one. The original Datable is unchanged.

Specified by:
addYears in interface Datable<T extends Datable<? super T>>
Parameters:
amount - the amount to add, may be negative
Returns:
the new Datable with the amount added

addMonths

public T addMonths(int amount)
Description copied from interface: Datable
Adds a number of months to the datable instance returning a new one. The original Datable is unchanged.

Specified by:
addMonths in interface Datable<T extends Datable<? super T>>
Parameters:
amount - the amount to add, may be negative
Returns:
the new Datable with the amount added

addWeeks

public T addWeeks(int amount)
Description copied from interface: Datable
Adds a number of weeks to the datable instance returning a new one. The original Datable is unchanged.

Specified by:
addWeeks in interface Datable<T extends Datable<? super T>>
Parameters:
amount - the amount to add, may be negative
Returns:
the new Datable with the amount added

addDays

public T addDays(int amount)
Description copied from interface: Datable
Adds a number of days to the datable instance returning a new one. The original Datable is unchanged.

Specified by:
addDays in interface Datable<T extends Datable<? super T>>
Parameters:
amount - the amount to add, may be negative
Returns:
the new Datable with the amount added

addHours

public T addHours(int amount)
Description copied from interface: Datable
Adds a number of hours to the datable instance returning a new one. The original Datable is unchanged.

Specified by:
addHours in interface Datable<T extends Datable<? super T>>
Parameters:
amount - the amount to add, may be negative
Returns:
the new Datable with the amount added

addMinutes

public T addMinutes(int amount)
Description copied from interface: Datable
Adds a number of minutes to the datable instance returning a new one. The original Datable is unchanged.

Specified by:
addMinutes in interface Datable<T extends Datable<? super T>>
Parameters:
amount - the amount to add, may be negative
Returns:
the new Datable with the amount added

addSeconds

public T addSeconds(int amount)
Description copied from interface: Datable
Adds a number of seconds to the datable instance returning a new one. The original Datable is unchanged.

Specified by:
addSeconds in interface Datable<T extends Datable<? super T>>
Parameters:
amount - the amount to add, may be negative
Returns:
the new Datable with the amount added

addMilliseconds

public T addMilliseconds(int amount)
Description copied from interface: Datable
Adds a number of milliseconds to the datable instance returning a new one. The original Datable is unchanged.

Specified by:
addMilliseconds in interface Datable<T extends Datable<? super T>>
Parameters:
amount - the amount to add, may be negative
Returns:
the new Datable with the amount added

isDefined

public boolean isDefined()
Description copied from interface: Datable
Indicates is the date is different from DateUtil.MINIMUM_DATE or DateUtil.MAXIMUM_DATE.

Specified by:
isDefined in interface Datable<T extends Datable<? super T>>
Returns:
true if the date is not equal to undifined one, false otherwise.

isNotDefined

public boolean isNotDefined()
Description copied from interface: Datable
Indicates the opposite of Datable.isDefined()

Specified by:
isNotDefined in interface Datable<T extends Datable<? super T>>
Returns:


Copyright © 2016 Silverpeas. All Rights Reserved.