java.lang.Object
java.lang.Record
org.litebridge.db.spi.expression.ConvertExpression
- Record Components:
target- The encapsulated target column expression for this expression.typeOverride- The class type that overrides the default type.
- All Implemented Interfaces:
DelegateExpression,SelectExpression
public record ConvertExpression(SelectExpression target, Class<?> typeOverride)
extends Record
implements DelegateExpression
Represents a conversion expression that wraps another
SelectExpression,
potentially overriding its type.
This class serves as a decorator around a target SelectExpression, allowing
for an optional type override. It delegates SQL generation to the encapsulated target
expression.
-
Constructor Summary
ConstructorsConstructorDescriptionConvertExpression(SelectExpression target, Class<?> typeOverride) Creates an instance of aConvertExpressionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.target()Returns the value of thetargetrecord component.toSql(Operation operation, ClauseType clause, @Nullable DelegateExpression parent) Creates a SQL representation of the expression, providing the immediate nesting/parent expression.final StringtoString()Returns a string representation of this record class.Class<?> Returns the value of thetypeOverriderecord component.Methods 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
-
ConvertExpression
Creates an instance of aConvertExpressionrecord class.- Parameters:
target- the value for thetargetrecord componenttypeOverride- the value for thetypeOverriderecord component
-
-
Method Details
-
toSql
Description copied from interface:SelectExpressionCreates a SQL representation of the expression, providing the immediate nesting/parent expression.- 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
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
target
Returns the value of thetargetrecord component.- Specified by:
targetin interfaceDelegateExpression- Returns:
- the value of the
targetrecord component
-
typeOverride
Returns the value of thetypeOverriderecord component.- Returns:
- the value of the
typeOverriderecord component
-