Top Description Fields Constructors Methods
org.eclipse.persistence.jpa.jpql.tools.model.query

public Class DateTimeStateObject

extends SimpleStateObject
Class Inheritance
Annotations
@SuppressWarnings:unused
Imports
org.eclipse.persistence.jpa.jpql.parser.DateTime

This DateTimeStateObject represents a date or time. It supports the following identifiers:

CURRENT_DATE: This function returns the value of current date on the database server.

CURRENT_TIME: This function returns the value of current time on the database server.

CURRENT_TIMESTAMP: This function returns the value of current timestamp on the database server.

BNF: functions_returning_datetime ::= CURRENT_DATE | CURRENT_TIME | CURRENT_TIMESTAMP

The JDBC escape syntax may be used for the specification of date, time, and timestamp literals.

BNF: expression ::= {d 'yyyy-mm-dd'} | {t 'hh:mm:ss'} | {ts 'yyyy-mm-dd hh:mm:ss.f...'}

Author
Pascal Filion
Since
2.4
Version
2.4
See Also
DateTime

Field Summary

Inherited from org.eclipse.persistence.jpa.jpql.tools.model.query.SimpleStateObject:
TEXT_PROPERTY

Constructor Summary

AccessConstructor and Description
public
DateTimeStateObject(StateObject
The parent of this state object, which cannot be null
parent
)

Creates a new DateTimeStateObject.

public
DateTimeStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
String
Either DATE, TIME, TIMESTAMP or a JDBC date
date
)

Creates a new DateTimeStateObject.

Method Summary

Modifier and TypeMethod and Description
public void
public DateTime
getExpression()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.getExpression.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getExpression.

Returns the actual parsed object if this StateObject representation of the JPQL query was created by parsing an existing JPQL query.
public boolean

Returns:

true if this Expression represents CURRENT_DATE; false otherwise
isCurrentDate
()

Determines whether this DateTime represents the JPQL identifier CURRENT_DATE.

public boolean

Returns:

true if this Expression represents CURRENT_TIME; false otherwise
isCurrentTime
()

Determines whether this DateTime represents the JPQL identifier CURRENT_TIME.

public boolean

Returns:

true if this Expression represents CURRENT_TIMESTAMP; false otherwise
isCurrentTimestamp
()

Determines whether this DateTime represents the JPQL identifier CURRENT_TIMESTAMP.

public boolean

Returns:

true if this Expression represents a JDBC escape syntax; false otherwise
isJDBCDate
()

Determines whether this DateTime represents the JDBC escape syntax for date, time, timestamp formats.

public void
setExpression(DateTime
The parsed object representing a date literal
expression
)

Keeps a reference of the parsed object object, which should only be done when this object is instantiated during the conversion of a parsed JPQL query into StateObjects.

Inherited from org.eclipse.persistence.jpa.jpql.tools.model.query.SimpleStateObject:
getTexthasTextisEquivalentsetTextsetTextInternallytoTextInternal

Constructor Detail

DateTimeStateObjectback to summary
public DateTimeStateObject(StateObject parent)

Creates a new DateTimeStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

Exceptions
NullPointerException:
The given parent cannot be null
DateTimeStateObjectback to summary
public DateTimeStateObject(StateObject parent, String date)

Creates a new DateTimeStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

date:String

Either DATE, TIME, TIMESTAMP or a JDBC date

Exceptions
NullPointerException:
The given parent cannot be null

Method Detail

acceptback to summary
public void accept(StateObjectVisitor visitor)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.accept.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.accept.

Visits this StateObject by the given visitor.

Parameters
visitor:StateObjectVisitor

The visitor to visit this object

Annotations
@Override
getExpressionback to summary
public DateTime getExpression()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.getExpression.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getExpression.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getExpression.

Returns the actual parsed object if this StateObject representation of the JPQL query was created by parsing an existing JPQL query.

Returns:DateTime

The parsed object when a JPQL query is parsed and converted into a StateObject or null when the JPQL query is manually created (i.e. not from a string)

Annotations
@Override
isCurrentDateback to summary
public boolean isCurrentDate()

Determines whether this DateTime represents the JPQL identifier CURRENT_DATE.

Returns:boolean

true if this Expression represents CURRENT_DATE; false otherwise

isCurrentTimeback to summary
public boolean isCurrentTime()

Determines whether this DateTime represents the JPQL identifier CURRENT_TIME.

Returns:boolean

true if this Expression represents CURRENT_TIME; false otherwise

isCurrentTimestampback to summary
public boolean isCurrentTimestamp()

Determines whether this DateTime represents the JPQL identifier CURRENT_TIMESTAMP.

Returns:boolean

true if this Expression represents CURRENT_TIMESTAMP; false otherwise

isJDBCDateback to summary
public boolean isJDBCDate()

Determines whether this DateTime represents the JDBC escape syntax for date, time, timestamp formats.

Returns:boolean

true if this Expression represents a JDBC escape syntax; false otherwise

setExpressionback to summary
public void setExpression(DateTime expression)

Keeps a reference of the parsed object object, which should only be done when this object is instantiated during the conversion of a parsed JPQL query into StateObjects.

Parameters
expression:DateTime

The parsed object representing a date literal