Joda System API

org.joda.property.type
Interface TimeProperty

All Superinterfaces:
java.lang.Comparable, DataProperty, InstantProperty, ModelElement, Property, org.joda.time.ReadableInstant, org.joda.time.ReadWritableInstant, java.io.Serializable
All Known Subinterfaces:
DateTimeProperty
All Known Implementing Classes:
DefaultDateTimeProperty, DefaultTimeProperty

public interface TimeProperty
extends InstantProperty, org.joda.time.ReadWritableInstant

Interface for Time properties, based on ISO8601 time definitions. The methods on TimeProperty represent the 'normal' time concepts of hours, minutes and seconds, not any abstract period of time - see DurationProperty. The decision to merge the functionality of the Java Date, Calendar and GregorianCalendar classes was taken to provide a more obvious interface. The specific get methods return values in the ranges from the ISO standard. It is expected that implementations cannot hold invalid times, thus exceptions should be thrown by constructors and set methods.

Calendar does not describe a standard String format. However such a format is required for various property methods. The String format must completely encapsulate the property's value and be portable so far as possible between two completely different implementations. To achieve this the basic String format is ISO8601.

Output Times

The format is Thh:mm:ss. For example, for 4:30 pm:
T16:30:00.000

Input Times

Various formats are accepted. For example, considering 4:30 pm, 26.4 seconds:
16:30:26.400 (full representation)
1630264 (full representation, compact)
16:30:26 or 163026 (hour/minute/second only)
16:30 or 1630 (hour/minute only)
16 (hour only)

DateTime

The format is the Date part followed by a 'T' then the time part.

A dash may be used to represent missing portions of the string. One dash is used to represent the part missing even if it is more than one character normally.
A comma may be used in place of the decimal point in times (ISO in fact prefers this).
The time may be prefixed by 'T' to indicate it is a time as opposed to a date.
The letters (T/Z) may be lower case.

Add behaviour

Two questions arise when considering add behaviour:
Should the added value wrap with Two variations on add methods are provided - add() and addWrapped(). addWrapped() does not impact any other fields. if necessary, it wraps within itself.
add() impacts the next higher field and so on if a large value is added.

Author:
Stephen Colebourne

Nested Class Summary
 
Nested classes inherited from class org.joda.property.Property
Property.Internal
 
Field Summary
static java.lang.Class DEFAULT_TYPE
           
 
Methods inherited from interface org.joda.property.type.InstantProperty
get, toCalendar, toDate, toGregorianCalendar
 
Methods inherited from interface org.joda.property.type.DataProperty
toDataString
 
Methods inherited from interface org.joda.property.Property
addPropertyChangeListener, bean, equals, equalsValue, firePropertyChange, getContentName, getContentType, getPropertyName, getPropertyType, hashCode, isModifiable, isNull, isReadOnly, removePropertyChangeListener, set, setModifiable, setReadOnly, toObject, toString
 
Methods inherited from interface org.joda.property.ModelElement
getAttribute, getAttributeCount, getAttributeMap, setAttribute
 
Methods inherited from interface org.joda.time.ReadWritableInstant
add, add, addMillis, addWrapped, set, setMillis, setMillis
 
Methods inherited from interface org.joda.time.ReadableInstant
compareTo, equals, get, getChronology, getDateTimeZone, getMillis, hashCode, isAfter, isBefore, isEqual, toCopy, toCopy, toInstant, toString
 

Field Detail

DEFAULT_TYPE

public static final java.lang.Class DEFAULT_TYPE

Joda System API

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