org.fudgemsg.types
Class FudgeDate

java.lang.Object
  extended by org.fudgemsg.types.FudgeDate
All Implemented Interfaces:
DateProvider

public class FudgeDate
extends Object
implements DateProvider

Dummy class for holding a date value on its own, at varying precision. Dates can be more easily used through the secondary type mechanism.

For more details, please refer to DateTime encoding.


Constructor Summary
  FudgeDate(Calendar date)
          Creates a new FudgeDate object.
  FudgeDate(DateProvider dateProvider)
          Creates a new FudgeDate object.
protected FudgeDate(Instant instant)
          Creates a new FudgeDate object.
  FudgeDate(InstantProvider instantProvider)
          Creates a new FudgeDate object.
  FudgeDate(int year)
          Constructs a new FudgeDate object representing just a year.
  FudgeDate(int year, int month)
          Constructs a new FudgeDate object representing a year and a month.
  FudgeDate(int year, int month, int day)
          Constructs a new FudgeDate object.
protected FudgeDate(LocalDate localDate)
          Creates a new FudgeDate object.
 
Method Summary
 boolean equals(Object o)
          
 DateTimeAccuracy getAccuracy()
          Returns the accuracy of the Date.
 int getDayOfMonth()
          Returns the day of the month, or 0 if the date just represents a year or year/month.
 int getMonthOfYear()
          Returns the month of the year, or 0 if the date just represents a year
 int getYear()
          Returns the year.
 int hashCode()
          
 LocalDate toLocalDate()
          
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FudgeDate

public FudgeDate(int year)
Constructs a new FudgeDate object representing just a year.

Parameters:
year - the year

FudgeDate

public FudgeDate(int year,
                 int month)
Constructs a new FudgeDate object representing a year and a month.

Parameters:
year - the year
month - the month

FudgeDate

public FudgeDate(int year,
                 int month,
                 int day)
Constructs a new FudgeDate object.

Parameters:
year - the year
month - the month
day - the day

FudgeDate

public FudgeDate(Calendar date)
Creates a new FudgeDate object.

Parameters:
date - Calendar object supplying the year, month and day

FudgeDate

protected FudgeDate(Instant instant)
Creates a new FudgeDate object.

Parameters:
instant - the date corresponding to this instant at UTC will initialize the object

FudgeDate

protected FudgeDate(LocalDate localDate)
Creates a new FudgeDate object.

Parameters:
localDate - the LocalDate representation of the date

FudgeDate

public FudgeDate(InstantProvider instantProvider)
Creates a new FudgeDate object.

Parameters:
instantProvider - the date corresponding to the Instant provided at UTC will initialize the object

FudgeDate

public FudgeDate(DateProvider dateProvider)
Creates a new FudgeDate object.

Parameters:
dateProvider - provides the LocalDate representation of the date
Method Detail

toString

public String toString()

Overrides:
toString in class Object

equals

public boolean equals(Object o)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

getYear

public int getYear()
Returns the year.

Returns:
the year

getMonthOfYear

public int getMonthOfYear()
Returns the month of the year, or 0 if the date just represents a year

Returns:
the month of the year

getDayOfMonth

public int getDayOfMonth()
Returns the day of the month, or 0 if the date just represents a year or year/month.

Returns:
the day of the month

getAccuracy

public DateTimeAccuracy getAccuracy()
Returns the accuracy of the Date.

Returns:
the accuracy

toLocalDate

public LocalDate toLocalDate()

Specified by:
toLocalDate in interface DateProvider


Copyright 2009-Present by OpenGamma Inc. and individual contributors
Released under the Apache License, Version 2.0