net.objectlab.kit.datecalc.common
Class Utils

Package class diagram package Utils
java.lang.Object
  extended by net.objectlab.kit.datecalc.common.Utils

public final class Utils
extends Object

Utilities class for Date/Calendar conversions

Version:
$Revision: 298 $ $Date: 2010-03-12 19:49:41 -0500 (Fri, 12 Mar 2010) $
Author:
Marcin Jekot, $LastModifiedBy$

Method Summary
static Calendar blastTime(Calendar cal)
          Removes set's all "time" fields to zero, leaving only the date portion of the Calendar.
static Calendar createCalendar(String dateStr)
          get a new Calendar based on the string date.
static Date createDate(String dateStr)
          Creates a Date object given a string representation of it
static Calendar getCal(Date date)
          Get a Calendar object for a given Date representation.
static Calendar getCal(String dateStr)
           
static Set<Calendar> toCalendarSet(Set<Date> dates)
          Converts a Set of Date objects to a Set of Calendar objects.
static List<Date> toDateList(List<Calendar> dates)
          Converts a List of Calendar objects to a List of dates
static Set<Date> toDateSet(Set<Calendar> calendars)
          Converts a Set of Calendar objects to a Set of Date objects
static HolidayCalendar<Calendar> toHolidayCalendarSet(HolidayCalendar<Date> dates)
          Converts a Set of Date objects to a Set of Calendar objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

blastTime

public static Calendar blastTime(Calendar cal)
Removes set's all "time" fields to zero, leaving only the date portion of the Calendar. The Calendar passe

Parameters:
cal - to Calendar object to blast, note, it will be modified
Returns:
the calendar object modified (same instance)

createDate

public static Date createDate(String dateStr)
Creates a Date object given a string representation of it

Parameters:
dateStr - string (return today if string is null)
Returns:
today if string is null, a Date object representing the string otherwise
Throws:
IllegalArgumentException - if the string cannot be parsed.

createCalendar

public static Calendar createCalendar(String dateStr)
get a new Calendar based on the string date.

Parameters:
dateStr - the date string
Returns:
a new Calendar
Throws:
IllegalArgumentException - if the string cannot be parsed.

getCal

public static Calendar getCal(String dateStr)

getCal

public static Calendar getCal(Date date)
Get a Calendar object for a given Date representation.

Parameters:
date -
Returns:
the Calendar

toCalendarSet

public static Set<Calendar> toCalendarSet(Set<Date> dates)
Converts a Set of Date objects to a Set of Calendar objects.

Parameters:
dates -
Returns:
the converted Set

toHolidayCalendarSet

public static HolidayCalendar<Calendar> toHolidayCalendarSet(HolidayCalendar<Date> dates)
Converts a Set of Date objects to a Set of Calendar objects.

Parameters:
dates -
Returns:
the converted Set

toDateSet

public static Set<Date> toDateSet(Set<Calendar> calendars)
Converts a Set of Calendar objects to a Set of Date objects

Parameters:
calendars -
Returns:
the converset Set

toDateList

public static List<Date> toDateList(List<Calendar> dates)
Converts a List of Calendar objects to a List of dates

Parameters:
dates -
Returns:
the converted List


Copyright © 2006-2010 Appendium - Portfolio Financing Platform. All Rights Reserved.