Package org.jooq

Interface FieldLike

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <T> Field<T> asField()
      The underlying field representation of this object.
      <T> Field<T> asField​(java.lang.String alias)
      The underlying field representation of this object.
      <T> Field<T> asField​(java.util.function.Function<? super Field<T>,​? extends java.lang.String> aliasFunction)
      The underlying field representation of this object.
    • Method Detail

      • asField

        <T> Field<T> asField()
        The underlying field representation of this object.

        This method is useful for things like SELECT y.*, (SELECT a FROM x) FROM y

        Returns:
        This result provider as a Field<?> object
      • asField

        <T> Field<T> asField​(java.lang.String alias)
        The underlying field representation of this object.

        This method is useful for things like SELECT y.*, (SELECT a FROM x) [alias] FROM y

        Note that the case-sensitivity of the returned field depends on Settings.getRenderQuotedNames(). By default, field aliases are quoted, and thus case-sensitive in many SQL dialects!

        Returns:
        This result provider as a Field<?> object
      • asField

        @Support
        <T> Field<T> asField​(java.util.function.Function<? super Field<T>,​? extends java.lang.String> aliasFunction)
        The underlying field representation of this object.

        This method is useful for things like SELECT y.*, (SELECT a FROM x) [alias] FROM y

        Note that the case-sensitivity of the returned field depends on Settings.getRenderQuotedNames(). By default, field aliases are quoted, and thus case-sensitive in many SQL dialects!

        This works like asField(String), except that field aliases are provided by a function. This is useful, for instance, to prefix all columns with a common prefix (on Table.as(String, Function)):

         MY_TABLE.as("t1", f -> "prefix_" + f.getName());
         

        And then to use the same function also for individual fields:

         MY_TABLE.MY_COLUMN.as(f -> "prefix_" + f.getName());