com.atlassian.jira.jql.util
Class JqlLocalDateSupportImpl

java.lang.Object
  extended by com.atlassian.jira.jql.util.JqlLocalDateSupportImpl
All Implemented Interfaces:
JqlLocalDateSupport

@ThreadSafe
public final class JqlLocalDateSupportImpl
extends Object
implements JqlLocalDateSupport

Default implementation for JqlLocalDateSupport

Since:
v4.4

Field Summary
static String PATTERN_WITH_HYPHEN
           
static String PATTERN_WITH_SLASH
           
 
Constructor Summary
JqlLocalDateSupportImpl(com.atlassian.core.util.Clock clock, TimeZoneManager timeZoneManager)
           
JqlLocalDateSupportImpl(TimeZoneManager timeZoneManager)
           
 
Method Summary
 Date convertToDate(LocalDate date)
          Converts a LocalDate to a Date using the systems time zone.
 LocalDate convertToLocalDate(Long dateLong)
          Try to parse the passed date long.
 LocalDate convertToLocalDate(String dateString)
          Try to parse the passed date string using the formats that JQL understands.
 String getIndexedValue(LocalDate date)
          Converts a date into the index-friendly format.
 String getLocalDateString(LocalDate localDate)
          Return a string representation of the passed date.
 boolean validate(String dateString)
          Check to see if the passed string is a valid date according to JQL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATTERN_WITH_SLASH

public static final String PATTERN_WITH_SLASH
See Also:
Constant Field Values

PATTERN_WITH_HYPHEN

public static final String PATTERN_WITH_HYPHEN
See Also:
Constant Field Values
Constructor Detail

JqlLocalDateSupportImpl

public JqlLocalDateSupportImpl(com.atlassian.core.util.Clock clock,
                               TimeZoneManager timeZoneManager)

JqlLocalDateSupportImpl

public JqlLocalDateSupportImpl(TimeZoneManager timeZoneManager)
Method Detail

convertToLocalDate

public LocalDate convertToLocalDate(String dateString)
Description copied from interface: JqlLocalDateSupport
Try to parse the passed date string using the formats that JQL understands. It will consider the user's time zone when parsing the date string.

Specified by:
convertToLocalDate in interface JqlLocalDateSupport
Parameters:
dateString - the string to parse. Cannot be empty or null.
Returns:
the parsed date.

convertToLocalDate

public LocalDate convertToLocalDate(Long dateLong)
Description copied from interface: JqlLocalDateSupport
Try to parse the passed date long.

Specified by:
convertToLocalDate in interface JqlLocalDateSupport
Parameters:
dateLong - the string to parse. Cannot be empty or null.
Returns:
the parsed date.

getIndexedValue

public String getIndexedValue(LocalDate date)
Description copied from interface: JqlLocalDateSupport
Converts a date into the index-friendly format.

Specified by:
getIndexedValue in interface JqlLocalDateSupport
Parameters:
date - the date
Returns:
a string representing the date, ready for comparison to indexed values.

validate

public boolean validate(String dateString)
Description copied from interface: JqlLocalDateSupport
Check to see if the passed string is a valid date according to JQL.

Specified by:
validate in interface JqlLocalDateSupport
Parameters:
dateString - the string to check cannot be null.
Returns:
true if the date is valid; false otherwise.

getLocalDateString

public String getLocalDateString(LocalDate localDate)
Description copied from interface: JqlLocalDateSupport
Return a string representation of the passed date. This method should just convert the date into its parseable String representation.

Specified by:
getLocalDateString in interface JqlLocalDateSupport
Parameters:
localDate - the date to convert. Cannot be null.
Returns:
return the passed date as a string.

convertToDate

public Date convertToDate(LocalDate date)
Description copied from interface: JqlLocalDateSupport
Converts a LocalDate to a Date using the systems time zone.

Specified by:
convertToDate in interface JqlLocalDateSupport
Parameters:
date - the date to convert. Cannot be null.
Returns:
return the Date for the local date.


Copyright © 2002-2014 Atlassian. All Rights Reserved.