fix Expressions.toQueryGranularity to be more correct, improve javadocs of Expr.getIdentifierIfIdentifier and Expr.getBindingIfIdentifier (#9363)

This commit is contained in:
Clint Wylie 2020-02-16 08:36:40 -08:00 committed by GitHub
parent 6d52edddab
commit b1be88d79c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -80,7 +80,10 @@ public interface Expr
} }
/** /**
* Returns the string identifier of an {@link IdentifierExpr}, else null * Returns the string identifier of an {@link IdentifierExpr}, else null. Use this method to analyze an {@link Expr}
* tree when trying to distinguish between different {@link IdentifierExpr} with the same
* {@link IdentifierExpr#binding}. Do NOT use this method to analyze the input binding (e.g. backing column name),
* use {@link #getBindingIfIdentifier} instead.
*/ */
@Nullable @Nullable
default String getIdentifierIfIdentifier() default String getIdentifierIfIdentifier()
@ -91,7 +94,7 @@ public interface Expr
/** /**
* Returns the string key to use to get a value from {@link Expr.ObjectBinding} of an {@link IdentifierExpr}, * Returns the string key to use to get a value from {@link Expr.ObjectBinding} of an {@link IdentifierExpr},
* else null * else null. Use this method to analyze the inputs required to an {@link Expr} tree (e.g. backing column name).
*/ */
@Nullable @Nullable
default String getBindingIfIdentifier() default String getBindingIfIdentifier()

View File

@ -703,7 +703,7 @@ public class Expressions
final Expr arg = expr.getArg(); final Expr arg = expr.getArg();
final Granularity granularity = expr.getGranularity(); final Granularity granularity = expr.getGranularity();
if (ColumnHolder.TIME_COLUMN_NAME.equals(arg.getIdentifierIfIdentifier())) { if (ColumnHolder.TIME_COLUMN_NAME.equals(arg.getBindingIfIdentifier())) {
return granularity; return granularity;
} else { } else {
return null; return null;