net.sourceforge.pebble.domain
Class Month

java.lang.Object
  extended by net.sourceforge.pebble.domain.TimePeriod
      extended by net.sourceforge.pebble.domain.Month
All Implemented Interfaces:
Permalinkable

public class Month
extends TimePeriod
implements Permalinkable

Represents a blog at a monthly level. This manages a collection of Day instances.

Author:
Simon Brown

Method Summary
 boolean after(Month month)
          Determines if the this Month is after (in the calendar) the specified Month.
 boolean before(Month month)
          Determines if the this Month is before (in the calendar) the specified Month.
 Day[] getAllDays()
          Gets an array of all Days.
 java.util.List<java.lang.String> getBlogEntries()
          Gets all blog entries for this month.
 Day getBlogForDay(int day)
          Gets a Day instance for the specified day.
 Day getBlogForFirstDay()
          Gets a Day instance for the first day of the month.
 Day getBlogForLastDay()
          Gets a Day instance for the last day of the month.
 int getLastDayInMonth()
          Gets the last day of the month.
 int getMonth()
          Gets an integer representing the month that this monthly blog is for.
 Month getNextMonth()
          Gets the Month instance for the next month.
 int getNumberOfBlogEntries()
          Gets the number of blog entries for this month.
 java.lang.String getPermalink()
          Gets the permalink to display all entries for this Month.
 Month getPreviousMonth()
          Gets the Month instance for the previous month.
 Year getYear()
          Gets a reference to the parent Year instance.
 boolean hasBlogEntries()
          Determines whether this monthly blog has entries.
 java.lang.String toString()
          Gets a string representation of this object.
 
Methods inherited from class net.sourceforge.pebble.domain.TimePeriod
getBlog, getDate, setDate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getYear

public Year getYear()
Gets a reference to the parent Year instance.

Returns:
a Year instance

getMonth

public int getMonth()
Gets an integer representing the month that this monthly blog is for.

Returns:
an int representing the month (i.e. 1 to 12)

getPermalink

public java.lang.String getPermalink()
Gets the permalink to display all entries for this Month.

Specified by:
getPermalink in interface Permalinkable
Returns:
an absolute URL

hasBlogEntries

public boolean hasBlogEntries()
Determines whether this monthly blog has entries.

Returns:
true if this blog contains entries, false otherwise

getBlogEntries

public java.util.List<java.lang.String> getBlogEntries()
Gets all blog entries for this month.

Returns:
a List of BlogEntry instances, reverse ordered by date

getNumberOfBlogEntries

public int getNumberOfBlogEntries()
Gets the number of blog entries for this month.

Returns:
an int

getAllDays

public Day[] getAllDays()
Gets an array of all Days.

Returns:
a Collection of Day instances for all those days that have entries (this can return an empty collection)

getBlogForDay

public Day getBlogForDay(int day)
Gets a Day instance for the specified day. This lazy loads Day instances as needed.

Parameters:
day - the day as an int (i.e. 1 to 31)
Returns:
the corresponding Day instance

getBlogForFirstDay

public Day getBlogForFirstDay()
Gets a Day instance for the first day of the month.

Returns:
the Day instance representing the first day in the month

getBlogForLastDay

public Day getBlogForLastDay()
Gets a Day instance for the last day of the month.

Returns:
the Day instance representing the last day in the month

getLastDayInMonth

public int getLastDayInMonth()
Gets the last day of the month.

Returns:
an int representing the last day in the month

getPreviousMonth

public Month getPreviousMonth()
Gets the Month instance for the previous month.

Returns:
a Month instance

getNextMonth

public Month getNextMonth()
Gets the Month instance for the next month.

Returns:
a Month instance

before

public boolean before(Month month)
Determines if the this Month is before (in the calendar) the specified Month.

Returns:
true if this instance represents an earlier month than the specified Month instance, false otherwise

after

public boolean after(Month month)
Determines if the this Month is after (in the calendar) the specified Month.

Returns:
true if this instance represents a later month than the specified Month instance, false otherwise

toString

public java.lang.String toString()
Gets a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
a String


Copyright © 2003-2006, Simon Brown. All Rights Reserved.