Class ConvertSpec<T>

java.lang.Object
org.litebridge.orm.expression.intent.ConvertSpec<T>
Type Parameters:
T - The target Java type for conversion.
All Implemented Interfaces:
ExpressionSpec, Resolvable, TypeOverride<T>, TypeOverrideExpressionSpec<T>

public final class ConvertSpec<T> extends Object implements TypeOverrideExpressionSpec<T>, Resolvable
Converts a database result into the specified Java type.

This uses Litebridge's registered type converter to perform the conversion; it is not a database operation.

  • Constructor Details

    • ConvertSpec

      public ConvertSpec(ExpressionSpec target, Class<T> returnType)
      Constructs a ConvertSpec with the specified target expression and return type.
      Parameters:
      target - the target expression to convert
      returnType - the class of the target Java type
  • Method Details

    • target

      public ExpressionSpec target()
      Gets the target expression for conversion.
      Returns:
      the target expression
    • returnType

      public Class<T> returnType()
      Description copied from interface: TypeOverride
      Gets the return type override of the query result.
      Specified by:
      returnType in interface TypeOverride<T>
      Returns:
      the type of the result.
    • column

      public String column()
      Description copied from interface: Resolvable
      Returns the target column name for this expression.
      Specified by:
      column in interface Resolvable
      Returns:
      the target column name.
    • type

      public Class<? extends ExpressionSpec> type()
      Description copied from interface: Resolvable
      Returns the type of ExpressionSpec that this Resolvable can resolve to.
      Specified by:
      type in interface Resolvable
      Returns:
      the type of ExpressionSpec that this Resolvable can resolve to.
    • replaceTarget

      public ConvertSpec<T> replaceTarget(ExpressionSpec resolvedExpressionSpec)
      Creates a new ConvertSpec with a replaced target expression.
      Parameters:
      resolvedExpressionSpec - the new target expression
      Returns:
      a new ConvertSpec instance