Joda System API

org.joda.property.impl.type
Class AbstractDateTimeProperty

java.lang.Object
  |
  +--org.joda.property.impl.AbstractModelElement
        |
        +--org.joda.property.impl.AbstractProperty
              |
              +--org.joda.property.impl.type.AbstractDateTimeProperty
All Implemented Interfaces:
InitializableProperty, ModelElement, Property, Property.Internal, java.io.Serializable
Direct Known Subclasses:
DefaultDateProperty, DefaultDateTimeProperty, DefaultTimeProperty

public abstract class AbstractDateTimeProperty
extends AbstractProperty

Abstract class useful for Date and Time property implementations.

Author:
Stephen Colebourne
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class org.joda.property.Property
Property.Internal
 
Field Summary
protected static long JAN_1ST_10000
           
protected static long JAN_1ST_1583
           
protected static long MILLIS_PER_DAY
           
protected static long MILLIS_PER_HOUR
           
protected static long MILLIS_PER_MINUTE
           
protected static long MILLIS_PER_SECOND
           
protected static long MILLIS_PER_WEEK
           
 
Constructor Summary
AbstractDateTimeProperty()
          Constructor
 
Method Summary
 void add(org.joda.time.DateTimeField field, int value)
           
 void add(java.lang.Object object)
           
 void addDays(int days)
           
 void addHours(int hours)
           
 void addMillis(long millis)
           
 void addMillisOfSecond(int milliseconds)
           
 void addMinutes(int minutes)
           
 void addMonths(int months)
           
 void addSeconds(int seconds)
           
 void addWeeks(int weeks)
           
 void addWrapped(org.joda.time.DateTimeField field, int value)
           
 void addWrappedDayOfMonth(int days)
           
 void addWrappedDayOfWeek(int days)
           
 void addWrappedDayOfYear(int days)
           
 void addWrappedHourOfDay(int hours)
           
 void addWrappedMillisOfSecond(int millis)
           
 void addWrappedMinuteOfHour(int minutes)
           
 void addWrappedMonthOfYear(int months)
           
 void addWrappedSecondOfMinute(int seconds)
           
 void addWrappedYear(int years)
           
 void addYears(int years)
           
 int compareTo(java.lang.Object object)
           
protected  org.joda.time.DateTime convertObjectToDate(java.lang.Object object)
          Convert an Object to a DateTime representing the time, throwing an exception if unable to convert.
protected  org.joda.time.DateTime convertObjectToDateTime(java.lang.Object object)
          Convert an Object to a DateTime representing the datetime, throwing an exception if unable to convert.
protected  org.joda.time.DateTime convertObjectToTime(java.lang.Object object)
          Convert an Object to a DateTime representing the time, throwing an exception if unable to convert.
 org.joda.time.DateTime get()
           
 int get(org.joda.time.DateTimeField field)
           
 org.joda.time.Chronology getChronology()
          Gets the chronology of the instant, ISO.
 org.joda.time.DateTimeZone getDateTimeZone()
           
 int getDayOfMonth()
           
 int getDayOfWeek()
           
 int getDayOfYear()
           
 int getHourOfDay()
           
protected  org.joda.time.DateTime getInternal()
          Get the current immutable datetime object underlying this property.
 long getMillis()
           
 int getMillisOfSecond()
           
 int getMinuteOfHour()
           
 int getMonthOfYear()
           
 java.lang.Class getPropertyType()
          Get the type of the property.
 int getSecondOfMinute()
           
 int getWeekOfWeekyear()
           
 int getWeekyear()
           
 int getYear()
           
protected  long getZeroedMillis()
          Get the millis, or zero if currently null
 boolean isAfter(org.joda.time.ReadableInstant datetime)
          Is the current property value after the time passed in
 boolean isBefore(org.joda.time.ReadableInstant datetime)
          Is the current property value before the time passed in
 boolean isEqual(org.joda.time.ReadableInstant datetime)
          Is the current property value equal the time passed in
 java.lang.Class propertyType()
          Get the type of the property
 void set(org.joda.time.DateTimeField field, int value)
           
 void set(java.lang.Object propertyValue)
          Set the property's value as an object.
 void setDate(int year, int month, int dayOfMonth)
           
 void setDate(long millis)
           
 void setDate(java.lang.Object propertyValue)
           
 void setDateTime(int year, int monthOfYear, int dayOfMonth)
           
 void setDateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay)
           
 void setDateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour)
           
 void setDateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute)
           
 void setDateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
           
 void setDateTime(long millis)
           
 void setDateTime(java.lang.Object propertyValue)
           
 void setDayOfMonth(int dayOfMonth)
           
 void setDayOfWeek(int dayOfWeek)
           
 void setDayOfYear(int dayOfYear)
           
 void setHourOfDay(int hour)
           
protected  void setInternal(org.joda.time.DateTime dt)
          Set the datetime, which has been validated
protected  void setInternal(long millis)
          Set the datetime, which has been validated
 void setMillis(long millis)
           
 void setMillis(java.lang.Object propertyValue)
           
 void setMillisOfSecond(int millis)
           
 void setMinuteOfHour(int minute)
           
 void setMonthOfYear(int month)
           
 void setSecondOfMinute(int second)
           
 void setTime(int hour, int minuteOfHour)
           
 void setTime(int hour, int minuteOfHour, int secondOfMinute)
           
 void setTime(int hour, int minuteOfHour, int secondOfMinute, int millisOfSecond)
           
 void setTime(long millis)
           
 void setTime(java.lang.Object propertyValue)
           
 void setWeekOfYear(int week, int year)
           
 void setYear(int year)
           
 java.util.Calendar toCalendar(java.util.Locale locale)
           
 org.joda.time.ReadableInstant toCopy(org.joda.time.Chronology newChronology)
           
 org.joda.time.ReadableInstant toCopy(long newMillis)
           
 java.util.Date toDate()
           
 org.joda.time.DateTime toDateTime()
           
 java.util.GregorianCalendar toGregorianCalendar()
           
 org.joda.time.Instant toInstant()
           
 java.lang.Object toObject()
          Get the property's value as an object.
 
Methods inherited from class org.joda.property.impl.AbstractProperty
addPropertyChangeListener, bean, checkArgumentNotNull, checkModifiable, checkValueNotNull, checkValueNotNull, cloneDeep, convertObject, createClonedProperty, data, equals, equalsValue, firePropertyChange, firePropertyChange, getContentName, getContentType, getPropertyName, getThis, hashCode, initBeanCreated, initPropertyCreated, isModifiable, isNull, isReadOnly, populateClonedProperty, removePropertyChangeListener, setModifiable, setReadOnly, toDataString, toString
 
Methods inherited from class org.joda.property.impl.AbstractModelElement
getAttribute, getAttributeCount, getAttributeMap, setAttribute
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.joda.property.ModelElement
getAttribute, getAttributeCount, getAttributeMap, setAttribute
 

Field Detail

MILLIS_PER_WEEK

protected static final long MILLIS_PER_WEEK
See Also:
Constant Field Values

MILLIS_PER_DAY

protected static final long MILLIS_PER_DAY
See Also:
Constant Field Values

MILLIS_PER_HOUR

protected static final long MILLIS_PER_HOUR
See Also:
Constant Field Values

MILLIS_PER_MINUTE

protected static final long MILLIS_PER_MINUTE
See Also:
Constant Field Values

MILLIS_PER_SECOND

protected static final long MILLIS_PER_SECOND
See Also:
Constant Field Values

JAN_1ST_1583

protected static final long JAN_1ST_1583
See Also:
Constant Field Values

JAN_1ST_10000

protected static final long JAN_1ST_10000
See Also:
Constant Field Values
Constructor Detail

AbstractDateTimeProperty

public AbstractDateTimeProperty()
Constructor

Method Detail

getPropertyType

public java.lang.Class getPropertyType()
Get the type of the property. A method String getFoo() has a property type of String.class.

Returns:
the property type

getInternal

protected org.joda.time.DateTime getInternal()
Get the current immutable datetime object underlying this property.


setInternal

protected void setInternal(org.joda.time.DateTime dt)
Set the datetime, which has been validated


setInternal

protected void setInternal(long millis)
Set the datetime, which has been validated


get

public org.joda.time.DateTime get()
See Also:
InstantProperty#get()

toObject

public java.lang.Object toObject()
Description copied from interface: Property
Get the property's value as an object. The object type will be appropriate for the type of property. The object will either be immutable or a clone of the real object.

This method has strong semantics such that where a and b are properties of the same type, it must be true that:
b.set( a.toObject() ); a.equals(b);
In other words, the object contains all the data necessary to recreate the property's value.

Specified by:
toObject in interface Property
Specified by:
toObject in class AbstractProperty
See Also:
Property#toObject()

toInstant

public org.joda.time.Instant toInstant()
See Also:
ReadableInstant.toInstant()

toDateTime

public org.joda.time.DateTime toDateTime()
See Also:
ReadableInstant#toDateTime()

toCalendar

public java.util.Calendar toCalendar(java.util.Locale locale)
See Also:
InstantProperty#toCalendar(Locale)

toGregorianCalendar

public java.util.GregorianCalendar toGregorianCalendar()
See Also:
InstantProperty#toGregorianCalendar()

toDate

public java.util.Date toDate()
See Also:
InstantProperty#toDate()

propertyType

public java.lang.Class propertyType()
Get the type of the property

Returns:
the Class representing the property's type

compareTo

public int compareTo(java.lang.Object object)
See Also:
Comparable.compareTo(Object)

isAfter

public boolean isAfter(org.joda.time.ReadableInstant datetime)
Is the current property value after the time passed in

Parameters:
datetime - another date time
Returns:
true if it is after

isBefore

public boolean isBefore(org.joda.time.ReadableInstant datetime)
Is the current property value before the time passed in

Parameters:
datetime - another date time
Returns:
true if it is before

isEqual

public boolean isEqual(org.joda.time.ReadableInstant datetime)
Is the current property value equal the time passed in

Parameters:
datetime - another date time
Returns:
true if it is before

convertObjectToDateTime

protected org.joda.time.DateTime convertObjectToDateTime(java.lang.Object object)
Convert an Object to a DateTime representing the datetime, throwing an exception if unable to convert.

Parameters:
object - the value to convert
Returns:
the converted DateTime

convertObjectToTime

protected org.joda.time.DateTime convertObjectToTime(java.lang.Object object)
Convert an Object to a DateTime representing the time, throwing an exception if unable to convert.

Parameters:
object - the value to convert
Returns:
the converted DateTime

convertObjectToDate

protected org.joda.time.DateTime convertObjectToDate(java.lang.Object object)
Convert an Object to a DateTime representing the time, throwing an exception if unable to convert.

Parameters:
object - the value to convert
Returns:
the converted DateTime

getMillis

public long getMillis()
See Also:
InstantProperty#getMillis()

getMillisOfSecond

public int getMillisOfSecond()
See Also:
ReadableTimeOnly#getMillisOfSecond()

getSecondOfMinute

public int getSecondOfMinute()
See Also:
ReadableTimeOnly#getSecondOfMinute()

getMinuteOfHour

public int getMinuteOfHour()
See Also:
ReadableTimeOnly#getMinuteOfHour()

getHourOfDay

public int getHourOfDay()
See Also:
ReadableTimeOnly#getHourOfDay()

getDayOfWeek

public int getDayOfWeek()
See Also:
ReadableDate#getDayOfWeek()

getDayOfMonth

public int getDayOfMonth()
See Also:
ReadableDate#getDayOfMonth()

getDayOfYear

public int getDayOfYear()
See Also:
ReadableDate#getDayOfYear()

getWeekOfWeekyear

public int getWeekOfWeekyear()
See Also:
ReadableDate#getWeekOfYearWeek()

getWeekyear

public int getWeekyear()
See Also:
ReadableDate#getWeekOfYearYear()

getMonthOfYear

public int getMonthOfYear()
See Also:
ReadableDate#getMonthOfYear()

getYear

public int getYear()
See Also:
ReadableDate#getYear()

set

public void set(java.lang.Object propertyValue)
Description copied from interface: Property
Set the property's value as an object. The object type should be appropriate for the type of property. If necessary, the object will be cloned before it is stored internally. Implementations will recognise as many types of object passed in as possible. Null should always be accepted, primitive types will be reset back to zero/false.

If a String is passed in, it can be parsed in various ways. If the results of toDataString() are passed in, it must reconstitute the original value.

Specified by:
set in interface Property
Specified by:
set in class AbstractProperty
See Also:
Property#set(Object)

setMillis

public void setMillis(java.lang.Object propertyValue)
See Also:
ReadWritableDate#setDate(Object)

setDate

public void setDate(java.lang.Object propertyValue)
See Also:
ReadWritableDate#setDate(Object)

setTime

public void setTime(java.lang.Object propertyValue)
See Also:
ReadWritableTime#setTime(Object)

setDateTime

public void setDateTime(java.lang.Object propertyValue)
See Also:
ReadWritableDateTime#setDateTime(Object)

setMillis

public void setMillis(long millis)
See Also:
ReadWritableInstant#setMillis(long)

setDate

public void setDate(long millis)
See Also:
ReadWritableDate#setDate(long)

setTime

public void setTime(long millis)
See Also:
ReadWritableTime#setTime(long)

setDateTime

public void setDateTime(long millis)
See Also:
ReadWritableDateTime#setDateTime(long)

setDate

public void setDate(int year,
                    int month,
                    int dayOfMonth)
See Also:
ReadWritableDate#setDate(int, int, int)

setDayOfWeek

public void setDayOfWeek(int dayOfWeek)
See Also:
ReadWritableDate#setDayOfWeek(int)

setDayOfMonth

public void setDayOfMonth(int dayOfMonth)
See Also:
ReadWritableDate#setDayOfMonth(int)

setDayOfYear

public void setDayOfYear(int dayOfYear)
See Also:
ReadWritableDate#setDayOfYear(int)

setWeekOfYear

public void setWeekOfYear(int week,
                          int year)
See Also:
ReadWritableDate#setWeekOfYear(int,int)

setMonthOfYear

public void setMonthOfYear(int month)

setYear

public void setYear(int year)
See Also:
ReadWritableDate#setYear(int)

add

public void add(java.lang.Object object)
See Also:
ReadWritableInstant.add(Object)

addMillis

public void addMillis(long millis)
See Also:
ReadWritableInstant#addMillis(long)

addYears

public void addYears(int years)
See Also:
ReadWritableDate#addYears(int)

addMonths

public void addMonths(int months)
See Also:
ReadWritableDate#addMonths(int)

addWeeks

public void addWeeks(int weeks)
See Also:
ReadWritableDate#addWeeks(int)

addDays

public void addDays(int days)
See Also:
ReadWritableDate#addDays(int)

addWrappedYear

public void addWrappedYear(int years)
See Also:
ReadWritableDate#addWrappedYear(int)

addWrappedMonthOfYear

public void addWrappedMonthOfYear(int months)
See Also:
ReadWritableDate#addWrappedMonthOfYear(int)

addWrappedDayOfYear

public void addWrappedDayOfYear(int days)
See Also:
ReadWritableDate#addWrappedDayOfYear(int)

addWrappedDayOfMonth

public void addWrappedDayOfMonth(int days)
See Also:
ReadWritableDate#addWrappedDayOfMonth(int)

addWrappedDayOfWeek

public void addWrappedDayOfWeek(int days)
See Also:
ReadWritableDate#addWrappedDayOfWeek(int)

setTime

public void setTime(int hour,
                    int minuteOfHour,
                    int secondOfMinute,
                    int millisOfSecond)
See Also:
ReadWritableTime#setTime(int, int, int, int)

setTime

public void setTime(int hour,
                    int minuteOfHour,
                    int secondOfMinute)
See Also:
ReadWritableTime#setTime(int, int, int)

setTime

public void setTime(int hour,
                    int minuteOfHour)
See Also:
ReadWritableTime#setTime(int, int)

setHourOfDay

public void setHourOfDay(int hour)
See Also:
ReadWritableTime#setHourOfDay(int)

setMinuteOfHour

public void setMinuteOfHour(int minute)
See Also:
ReadWritableTime#setMinuteOfHour(int)

setSecondOfMinute

public void setSecondOfMinute(int second)
See Also:
ReadWritableTime#setSecondOfMinute(int)

setMillisOfSecond

public void setMillisOfSecond(int millis)
See Also:
ReadWritableTime#setMillisOfSecond(int)

addHours

public void addHours(int hours)
See Also:
ReadWritableTime#addHours(int)

addMinutes

public void addMinutes(int minutes)
See Also:
ReadWritableTime#addMinutes(int)

addSeconds

public void addSeconds(int seconds)
See Also:
ReadWritableTime#addSeconds(int)

addMillisOfSecond

public void addMillisOfSecond(int milliseconds)
See Also:
ReadWritableTime#addMillisOfSecond(int)

addWrappedHourOfDay

public void addWrappedHourOfDay(int hours)
See Also:
ReadWritableTime#addWrappedHourOfDay(int)

addWrappedMinuteOfHour

public void addWrappedMinuteOfHour(int minutes)
See Also:
ReadWritableTime#addWrappedMinuteOfHour(int)

addWrappedSecondOfMinute

public void addWrappedSecondOfMinute(int seconds)
See Also:
ReadWritableTime#addWrappedSecondOfMinute(int)

addWrappedMillisOfSecond

public void addWrappedMillisOfSecond(int millis)
See Also:
ReadWritableTime#addWrappedMillisOfSecond(int)

setDateTime

public void setDateTime(int year,
                        int monthOfYear,
                        int dayOfMonth,
                        int hourOfDay,
                        int minuteOfHour,
                        int secondOfMinute,
                        int millisOfSecond)
See Also:
ReadWritableDateTime#setDateTime(int, int, int, int, int, int, int)

setDateTime

public void setDateTime(int year,
                        int monthOfYear,
                        int dayOfMonth,
                        int hourOfDay,
                        int minuteOfHour,
                        int secondOfMinute)
See Also:
ReadWritableDateTime#setDateTime(int, int, int, int, int, int)

setDateTime

public void setDateTime(int year,
                        int monthOfYear,
                        int dayOfMonth,
                        int hourOfDay,
                        int minuteOfHour)
See Also:
ReadWritableDateTime#setDateTime(int, int, int, int, int)

setDateTime

public void setDateTime(int year,
                        int monthOfYear,
                        int dayOfMonth,
                        int hourOfDay)
See Also:
ReadWritableDateTime#setDateTime(int, int, int, int)

setDateTime

public void setDateTime(int year,
                        int monthOfYear,
                        int dayOfMonth)
See Also:
ReadWritableDateTime#setDateTime(int, int, int)

getZeroedMillis

protected long getZeroedMillis()
Get the millis, or zero if currently null


add

public void add(org.joda.time.DateTimeField field,
                int value)
See Also:
ReadWritableInstant.add(DateTimeField, int)

addWrapped

public void addWrapped(org.joda.time.DateTimeField field,
                       int value)
See Also:
ReadWritableInstant.addWrapped(DateTimeField, int)

set

public void set(org.joda.time.DateTimeField field,
                int value)
See Also:
ReadWritableInstant.set(DateTimeField, int)

get

public int get(org.joda.time.DateTimeField field)
See Also:
ReadableInstant.get(DateTimeField)

getChronology

public org.joda.time.Chronology getChronology()
Gets the chronology of the instant, ISO.

Returns:
the Chronology, null if not applicable

getDateTimeZone

public org.joda.time.DateTimeZone getDateTimeZone()

toCopy

public org.joda.time.ReadableInstant toCopy(long newMillis)

toCopy

public org.joda.time.ReadableInstant toCopy(org.joda.time.Chronology newChronology)

Joda System API

Copyright © 2001-2003 Stephen Colebourne. All Rights Reserved.