Module litebridge.db.spi.impl
Class FunctionExpression
java.lang.Object
org.litebridge.db.spi.impl.expression.AbstractExpression
org.litebridge.db.spi.impl.expression.AbstractAliasedExpression
org.litebridge.db.spi.impl.expression.function.FunctionExpression
- All Implemented Interfaces:
AliasedExpression,DelegateExpression,SelectExpression
public abstract class FunctionExpression
extends AbstractAliasedExpression
implements DelegateExpression
Base class for function expressions operating on a column.
-
Field Summary
Fields inherited from class org.litebridge.db.spi.impl.expression.AbstractAliasedExpression
alias, tableAliasFields inherited from class org.litebridge.db.spi.impl.expression.AbstractExpression
labelGenerator -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFunctionExpression(SelectExpression target, @Nullable String alias, LabelGenerator labelGenerator) Constructor. -
Method Summary
Modifier and TypeMethodDescriptiontarget()Retrieves the target expression of this delegate.protected abstract Stringtemplate()Gets the template for the SQL representation of the function.toSql(Operation operation, ClauseType clause, @Nullable DelegateExpression parent) Creates a SQL representation of the expression.Methods inherited from class org.litebridge.db.spi.impl.expression.AbstractAliasedExpression
addAliasAs, alias, equals, hashCode, tableAlias, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.litebridge.db.spi.expression.SelectExpression
toSql
-
Constructor Details
-
FunctionExpression
protected FunctionExpression(SelectExpression target, @Nullable String alias, LabelGenerator labelGenerator) Constructor.- Parameters:
target- Target column expression to encapsulate.alias- The alias for the column expressionlabelGenerator- the label generator for rendering aliases/identifiers
-
-
Method Details
-
target
Description copied from interface:DelegateExpressionRetrieves the target expression of this delegate.- Specified by:
targetin interfaceDelegateExpression- Returns:
- The target expression.
-
toSql
Creates a SQL representation of the expression.This is usually used for expressions that do not require any aliases.
- Specified by:
toSqlin interfaceSelectExpression- Parameters:
operation- the operation that is being executedclause- The current clause type being evaluatedparent- The parent expression/nesting expression, ornullif this is a top-level expression- Returns:
- the SQL representation of the expression
-
template
Gets the template for the SQL representation of the function.The template should contain a single "%s" placeholder for the column identifier.
- Returns:
- SQL representation template
-