public class

CronHoursEntry

extends Object
java.lang.Object
   ↳ com.atlassian.jira.web.component.cron.parser.CronHoursEntry

Class Overview

Represents the hours part of a cron string. This class is responsible for parsing and validating the hours entry. The isValid() method refers only to what is supported by the cron editor for the hours entry.

Valid hours means a numerical hour (or range of the form x-y) with an optional trailing "/1", "/2" or "/3" to indicate the repeat increment in hours. This expects that numeric hours to be in 24 hour time format.

The hours and meridian attributes depend on whether this is a range entry or a "run once" entry. For ranges, use the "from" and "to" methods.

Summary

Public Constructors
CronHoursEntry(String cronEntry)
Parses the given value and establishes state based on this.
Public Methods
int getFrom()
Returns the lower bound of the hour range if this entry has a range.
String getFromMeridian()
Returns the meridian indicator @{link #AM} or @{link #AM} for the lower bound of a range entry.
int getIncrement()
Returns the increment or step size in hours or -1 if this entry has no increment.
int getRunOnce()
Returns the single hour value for this entry if it is a run once entry.
String getRunOnceMeridian()
Returns the meridian indicator @{link #AM} or @{link #AM} for the entry if it is a run once entry.
int getTo()
Returns the upper bound of the hour range if this entry has a range.
String getToMeridian()
Returns the meridian indicator @{link #AM} or @{link #AM} for the upper bound of a range entry.
boolean hasIncrement()
Indicates if this entry has an increment.
boolean isRunOnce()
boolean isValid()
Returns true only if the hours entry is valid with respect to the editor.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public CronHoursEntry (String cronEntry)

Parses the given value and establishes state based on this.

Parameters
cronEntry the hours field of a cron string.

Public Methods

public int getFrom ()

Returns the lower bound of the hour range if this entry has a range.

This end of the range is inclusive - e.g. if HoursFrom is 3PM and HoursTo is 5PM, the duration of the range is 2 hours.

Returns
  • the lower bound or -1 if this is not a range hour entry.

public String getFromMeridian ()

Returns the meridian indicator @{link #AM} or @{link #AM} for the lower bound of a range entry.

Returns
  • the meridian belonging to the lower bound hour or null if this is not a range entry.

public int getIncrement ()

Returns the increment or step size in hours or -1 if this entry has no increment.

Returns
  • the period of repetition in hours.

public int getRunOnce ()

Returns the single hour value for this entry if it is a run once entry.

Returns
  • the hour value or -1 if this is not a run once hour entry.

public String getRunOnceMeridian ()

Returns the meridian indicator @{link #AM} or @{link #AM} for the entry if it is a run once entry.

Returns
  • the meridian belonging single hour value or null if this is not a run once entry.

public int getTo ()

Returns the upper bound of the hour range if this entry has a range.

This end of the range is exclusive - e.g. if HoursFrom is 3PM and HoursTo is 5PM, the duration of the range is 2 hours.

Returns
  • the upper bound or -1 if this is not a range hour entry.

public String getToMeridian ()

Returns the meridian indicator @{link #AM} or @{link #AM} for the upper bound of a range entry.

Returns
  • the meridian belonging to the upper bound hour or null if this is not a range entry.

public boolean hasIncrement ()

Indicates if this entry has an increment.

Returns
  • true only if the entry has an increment part specified.

public boolean isRunOnce ()

public boolean isValid ()

Returns true only if the hours entry is valid with respect to the editor.

Returns
  • true only if the editor can handle this hour part.