RecurringDuration Class

com.bea.p13n.xml.schema
RecurringDuration Class

public class RecurringDuration

    extends Object
    implements Cloneable, Comparable, Serializable

This class provides the Java binding for the XML schema type recurringDuration as specified in Section 3.2.7 of XML Schema Part 2: Datatypes.

recurringDuration represents a specific period of time that recurs with a specific frequency, starting from a specific point in time. The value space of timeInstant is the space of timeDurations that recur with a specific timeDuration from a specific timeInstant.

Example: 2001-01-18T09:00:00.0005Z with a duration P1M and period P2D.

Values of th facets duration and period must be specified while creating an instance of RecurringDuration. Otherwise, this class uses defaults of "P0Y" for both duration and period.


Hierarchy
Object
  RecurringDuration
All Implemented Interfaces

Cloneable, Comparable, Serializable

Constructor Summary

RecurringDuration()

Constructs a new RecurringDuration instance with "P0Y" as the duration and period at the current point in time.
RecurringDuration(TimeInstant instant, TimeDuration duration, TimeDuration period)

Constructs a new RecurringDuration instance with the specified duration and period and at the specified point in time.

 

Method Summary

public Object
clone()
Retuns a copy of this RecurringDuration.
public int
compareTo(RecurringDuration anotherRecurringDuration)
Compares this RecurringDuration with another RecurringDuration.
public int
compareTo(Object anotherObject)

Compares this RecurringDuration with another object.

public static RecurringDuration
createRecurringDuration(String instant)
Returns a RecurringDuration instance at the specified point in time with a duration of "P0Y" and period of "P0Y".
public static RecurringDuration
createRecurringDuration(String instant, String duration, String period)

Returns a RecurringDuration instance at the specified point in time with the given duration and period.

public static RecurringDuration
createRecurringDuration(TimeInstant instant, TimeDuration duration, TimeDuration period)

Returns a RecurringDuration instance at the specified point in time with the given duration and period.

public TimeDuration
getDuration()
Returns the duration
public TimeInstant
getInstant()
Returns the point in time
public TimeDuration
getPeriod()
Returns the period
public void
setDuration(TimeDuration duration)
Sets the duration
public void
setInstant(TimeInstant instant)
Sets the point in time
public void
setPeriod(TimeDuration period)
Sets the period
public String
toString()

Returns a XML schema compliant recurringDuration string expressed as the instant of this Recurringduration.

 
Methods from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
   
Methods from interface java.lang.Comparable
compareTo
 

Constructor Detail

RecurringDuration

protected RecurringDuration()
Constructs a new RecurringDuration instance with "P0Y" as the duration and period at the current point in time.

RecurringDuration

protected RecurringDuration(TimeInstant instant, 
                            TimeDuration duration, 
                            TimeDuration period)

Constructs a new RecurringDuration instance with the specified duration and period and at the specified point in time.

 

Method Detail

clone() Method

public Object clone()
Retuns a copy of this RecurringDuration.

Overrides
Object.clone()

Returns

copy

compareTo(RecurringDuration) Method

public int compareTo(RecurringDuration anotherRecurringDuration)
Compares this RecurringDuration with another RecurringDuration.

Parameters

anotherRecurringDuration
another RecurringDuration object to be compared.

Returns

the value 0 if the argument RecurringDuration is equal to this RecurringDuration; a value less than 0 if this RecurringDuration starts before the RecurringDuration argument; and a value greater than 0 if this RecurringDuration starts after the RecurringDuration argument.

compareTo(Object) Method

public int compareTo(Object anotherObject)

Compares this RecurringDuration with another object. If the other object is a RecurringDuration, this method behaves like compareTo(RecurringDuration). Otherwise, it throws a ClassCastException.

Parameters

anotherObject
the object to be compared

Returns

the value 0 if the argument RecurringDuration is equal to this RecurringDuration; a value less than 0 if this RecurringDuration starts before the RecurringDuration argument; and a value greater than 0 if this RecurringDuration starts after the RecurringDuration argument.

createRecurringDuration(String) Method

public static RecurringDuration createRecurringDuration(String instant)
throws ParseException
Returns a RecurringDuration instance at the specified point in time with a duration of "P0Y" and period of "P0Y".

Parameters

instant
point in time

Exceptions

ParseException

createRecurringDuration(String, String, String) Method

public static RecurringDuration createRecurringDuration(String instant, 
                                                        String duration, 
                                                        String period)
throws ParseException

Returns a RecurringDuration instance at the specified point in time with the given duration and period.

Parameters

instant
point in time
duration
duration
period
period

Exceptions

ParseException

createRecurringDuration(TimeInstant, TimeDuration, TimeDuration) Method

public static RecurringDuration createRecurringDuration(TimeInstant instant, 
                                                        TimeDuration duration, 
                                                        TimeDuration period)
throws ParseException

Returns a RecurringDuration instance at the specified point in time with the given duration and period.

Parameters

instant
point in time
duration
duration
period
period

Exceptions

ParseException

getDuration() Method

public TimeDuration getDuration()
Returns the duration

Returns

duration

getInstant() Method

public TimeInstant getInstant()
Returns the point in time

Returns

point in time

getPeriod() Method

public TimeDuration getPeriod()
Returns the period

Returns

period

setDuration(TimeDuration) Method

public void setDuration(TimeDuration duration)
Sets the duration

Parameters

duration
duration

setInstant(TimeInstant) Method

public void setInstant(TimeInstant instant)
Sets the point in time

Parameters

instant
point in time

setPeriod(TimeDuration) Method

public void setPeriod(TimeDuration period)
Sets the period

Parameters

period
period

toString() Method

public String toString()

Returns a XML schema compliant recurringDuration string expressed as the instant of this Recurringduration.

Overrides
Object.toString()

Returns

string value