© 2005 BEA Systems, Inc.

com.bea.p13n.xml.schema
Class RecurringDuration

java.lang.Object
  extended bycom.bea.p13n.xml.schema.RecurringDuration
All Implemented Interfaces:
Cloneable, Comparable, Serializable

public class RecurringDuration
extends Object
implements Serializable, Cloneable, Comparable

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.

See Also:
Serialized Form

Constructor Summary
protected RecurringDuration()
          Constructs a new RecurringDuration instance with "P0Y" as the duration and period at the current point in time.
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 Summary
 Object clone()
          Retuns a copy of this RecurringDuration.
 int compareTo(Object anotherObject)
          Compares this RecurringDuration with another object.
 int compareTo(RecurringDuration anotherRecurringDuration)
          Compares this RecurringDuration with another RecurringDuration.
static RecurringDuration createRecurringDuration(String instant)
          Returns a RecurringDuration instance at the specified point in time with a duration of "P0Y" and period of "P0Y".
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.
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.
 TimeDuration getDuration()
          Returns the duration
 TimeInstant getInstant()
          Returns the point in time
 TimeDuration getPeriod()
          Returns the period
 void setDuration(TimeDuration duration)
          Sets the duration
 void setInstant(TimeInstant instant)
          Sets the point in time
 void setPeriod(TimeDuration period)
          Sets the period
 String toString()
          Returns a XML schema compliant recurringDuration string expressed as the instant of this Recurringduration.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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

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

Returns:
copy

compareTo

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.

Specified by:
compareTo in interface Comparable
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.
Throws:
IllegalArgumentException - thrown when the argument has a different duration and period.
ClassCastException - thrown if the argument is not an instance of TimeInstant.

compareTo

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.
Throws:
IllegalArgumentException - thrown when the argument has a different duration and period.

createRecurringDuration

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
Throws:
ParseException

createRecurringDuration

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
Throws:
ParseException

createRecurringDuration

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
Throws:
ParseException

getDuration

public TimeDuration getDuration()
Returns the duration

Returns:
duration

getInstant

public TimeInstant getInstant()
Returns the point in time

Returns:
point in time

getPeriod

public TimeDuration getPeriod()
Returns the period

Returns:
period

setDuration

public void setDuration(TimeDuration duration)
Sets the duration

Parameters:
duration - duration

setInstant

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

Parameters:
instant - point in time

setPeriod

public void setPeriod(TimeDuration period)
Sets the period

Parameters:
period - period

toString

public String toString()

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

Returns:
string value

© 2005 BEA Systems, Inc.

Copyright © 2005 BEA Systems, Inc. All Rights Reserved