[
https://issues.apache.org/jira/browse/JDO-652?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16601154#comment-16601154
]
Andy Jefferson edited comment on JDO-652 at 9/2/18 12:52 PM:
-
Re: mail to jdo-dev mailing list (which I don't subscribe to, and besides this
is the issue in JIRA so ought to be the focal point for any dev discussion
specific to this API),
*IF-THEN-ELSE* : this was added to JDOQL after the JDOQLTypedQuery API was
designed. Consequently there is no handling for it. What QueryDSL does is
likely the best option to use as a guide for how to provide it (see
[http://www.querydsl.com/static/querydsl/4.1.3/reference/html_single/#d0e2105]
and
[http://www.querydsl.com/static/querydsl/4.1.4/apidocs/com/querydsl/core/types/dsl/CaseBuilder.html]
). Adapting it to JDO we could have something like this. Create a
CaseExpression via builder method on JDOQLTypedQuery
CaseExpression caseExpr = JDOQLTypedQuery.newCaseExpression();
and then have methods on CaseExpression to
CaseExpression when(BooleanExpression condition, Expression valueExpr);
CaseExpression else(Expression valueExpr);
Or go via the QueryDSL CaseBuilder idea? If you have a better idea, propose
something?
*Ordering NULLS FIRST/LAST* : again, not part of JDOQL when this API was
designed. So we could do something like this
OrderExpression
public enum OrderNullsPosition
{ FIRST, LAST }
/**
* Accessor for the position of nulls with this expression.
* @return The nulls position (or null if not defined)
*/
OrderNullsPosition getNullsPosition();
/**
* Method to set nulls to be ordered BEFORE non-nulls.
* @return The order expression
*/
OrderExpression nullsFirst();
/**
* Method to set nulls to be ordered AFTER non-nulls.
* @return The order expression
*/
OrderExpression nullsLast();
If you have a better idea, propose something?
*Map.get(Expression)* : Was only added to JDOQL later in the dev cycle, so
just add it?
*sqrt(), abs() etc for primitive wrappers* : A primitive wrapper is a
NumericExpression, so are already part of the API. You likely need
_datanucleus-jdo-query v5.0.6_ to see them, but that is not an error in the
API, just the implementation having them later.
*StringExpression.startsWith(String, int)* : Was only added to JDOQL later in
the dev cycle, so just add it. And while at it add the equivalent(s) taking in
StringExpression, and NumericExpression.
was (Author: andy):
Re: mail to jdo-dev mailing list (which I don't subscribe to, and besides this
is the issue in JIRA so ought to be the focal point for any dev discussion
specific to this API),
*IF-THEN-ELSE* : this was added to JDOQL after the JDOQLTypedQuery API was
designed. Consequently there is no handling for it. What QueryDSL does is
likely the best option to use as a guide for how to provide it (see
[http://www.querydsl.com/static/querydsl/4.1.3/reference/html_single/#d0e2105]
and
[http://www.querydsl.com/static/querydsl/4.1.4/apidocs/com/querydsl/core/types/dsl/CaseBuilder.html]
). Adapting it to JDO we could have something like this. Create a
CaseExpression via builder method on JDOQLTypedQuery
CaseExpression caseExpr = JDOQLTypedQuery.newCaseExpression();
and then have methods on CaseExpression to
CaseExpression when(BooleanExpression condition, Expression valueExpr);
CaseExpression else(Expression valueExpr);
Or go via the QueryDSL CaseBuilder idea? If you have a better idea, propose
something?
*Ordering NULLS FIRST/LAST* : again, not part of JDOQL when this API was
designed. So we could do something like this
ComparableExpression
/**
* Method to set nulls to be ordered BEFORE non-nulls.
* @return The order expression
*/
OrderExpression nullsFirst();
/**
* Method to set nulls to be ordered AFTER non-nulls.
* @return The order expression
*/
OrderExpression nullsLast();
OrderExpression
public enum OrderNullsPosition
{
FIRST,
LAST
}
/**
* Accessor for the position of nulls with this expression.
* @return The nulls position (or null if not defined)
*/
OrderNullsPosition getNullsPosition();
If you have a better idea, propose something?
*Map.get(Expression)* : Was only added to JDOQL later in the dev cycle, so
just add it?
*sqrt(), abs() etc for primitive wrappers* : A primitive wrapper is a
NumericExpression, so are already part of the API. You likely need
_datanucleus-jdo-query v5.0.6_ to see them, but that is not an error in the
API, just the implementation having them later.
*StringExpression.startsWith(String, int)* : Was only added to JDOQL later in
the dev cycle, so just add it. And while at it add the equivalent(s) taking in
StringExpression, and