org.jooq.Field.cast()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(166)

本文整理了Java中org.jooq.Field.cast()方法的一些代码示例,展示了Field.cast()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Field.cast()方法的具体详情如下:
包路径:org.jooq.Field
类名称:Field
方法名:cast

Field.cast介绍

[英]Cast this field to another type.

The actual cast may not be accurate as the DataType has to be "guessed" from the jOOQ-configured data types. Use #cast(DataType) for more accurate casts.
[中]将此字段强制转换为其他类型。
实际的转换可能不准确,因为必须从jOOQ配置的数据类型中“猜测”数据类型。使用#强制转换(数据类型)进行更精确的强制转换。

代码示例

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

/**
 * Cast a value to the type of another field.
 *
 * @param <T> The generic type of the cast field
 * @param value The value to cast
 * @param as The field whose type is used for the cast
 * @return The cast field
 */
@Support
public static <T> Field<T> cast(Object value, Field<T> as) {
  return Utils.field(value, as).cast(as);
}

代码示例来源:origin: org.jooq/jooq

/**
 * Cast null to a type.
 *
 * @param <T> The generic type of the cast field
 * @param type The type that is used for the cast
 * @return The cast field
 */
@Support
public static <T> Field<T> castNull(DataType<T> type) {
  return NULL().cast(type);
}

代码示例来源:origin: org.jooq/jooq

/**
 * Cast a field to another type.
 *
 * @param <T> The generic type of the cast field
 * @param field The field to cast
 * @param type The type that is used for the cast
 * @return The cast field
 */
@Support
public static <T> Field<T> cast(Field<?> field, Class<T> type) {
  return nullSafe(field).cast(type);
}

代码示例来源:origin: org.jooq/jooq

/**
 * Cast null to a type.
 *
 * @param <T> The generic type of the cast field
 * @param type The type that is used for the cast
 * @return The cast field
 */
@Support
public static <T> Field<T> castNull(Class<T> type) {
  return NULL().cast(type);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

/**
 * Cast a field to the type of another field.
 *
 * @param <T> The generic type of the cast field
 * @param field The field to cast
 * @param as The field whose type is used for the cast
 * @return The cast field
 */
@Support
public static <T> Field<T> cast(Field<?> field, Field<T> as) {
  return nullSafe(field).cast(as);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

/**
 * Cast a value to another type.
 *
 * @param <T> The generic type of the cast field
 * @param value The value to cast
 * @param type The type that is used for the cast
 * @return The cast field
 */
@Support
public static <T> Field<T> cast(Object value, DataType<T> type) {
  return Utils.field(value, type).cast(type);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

/**
 * Cast null to a type.
 *
 * @param <T> The generic type of the cast field
 * @param type The type that is used for the cast
 * @return The cast field
 */
@Support
public static <T> Field<T> castNull(Class<T> type) {
  return NULL().cast(type);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

/**
 * Cast a field to another type.
 *
 * @param <T> The generic type of the cast field
 * @param field The value to cast
 * @param type The type that is used for the cast
 * @return The cast field
 */
@Support
public static <T> Field<T> cast(Field<?> field, DataType<T> type) {
  return nullSafe(field).cast(type);
}

代码示例来源:origin: org.jooq/jooq

/**
 * Cast a field to the type of another field.
 *
 * @param <T> The generic type of the cast field
 * @param field The field to cast
 * @param as The field whose type is used for the cast
 * @return The cast field
 */
@Support
public static <T> Field<T> cast(Field<?> field, Field<T> as) {
  return nullSafe(field).cast(as);
}

代码示例来源:origin: org.jooq/jooq

/**
 * Get the current_timestamp() function.
 * <p>
 * This translates into any dialect
 */
@Support
public static Field<OffsetDateTime> currentOffsetDateTime() {
  return currentTimestamp().cast(SQLDataType.OFFSETDATETIME);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

/**
 * Cast null to a type.
 *
 * @param <T> The generic type of the cast field
 * @param type The type that is used for the cast
 * @return The cast field
 */
@Support
public static <T> Field<T> castNull(DataType<T> type) {
  return NULL().cast(type);
}

代码示例来源:origin: org.jooq/jooq

/**
 * Cast a value to the type of another field.
 *
 * @param <T> The generic type of the cast field
 * @param value The value to cast
 * @param as The field whose type is used for the cast
 * @return The cast field
 */
@Support
public static <T> Field<T> cast(Object value, Field<T> as) {
  return Tools.field(value, as).cast(as);
}

代码示例来源:origin: org.jooq/jooq

/**
 * Cast null to the type of another field.
 *
 * @param <T> The generic type of the cast field
 * @param as The field whose type is used for the cast
 * @return The cast field
 */
@Support
public static <T> Field<T> castNull(Field<T> as) {
  return NULL().cast(as);
}

代码示例来源:origin: org.jooq/jooq

/**
 * Cast a value to another type.
 *
 * @param <T> The generic type of the cast field
 * @param value The value to cast
 * @param type The type that is used for the cast
 * @return The cast field
 */
@Support
public static <T> Field<T> cast(Object value, DataType<T> type) {
  return Tools.field(value).cast(type);
}

代码示例来源:origin: org.jooq/jooq

/**
 * Cast a field to another type.
 *
 * @param <T> The generic type of the cast field
 * @param field The value to cast
 * @param type The type that is used for the cast
 * @return The cast field
 */
@Support
public static <T> Field<T> cast(Field<?> field, DataType<T> type) {
  return nullSafe(field).cast(type);
}

代码示例来源:origin: org.jooq/jooq

/**
 * Get the current_time() function.
 * <p>
 * This translates into any dialect
 */
@Support
public static Field<OffsetTime> currentOffsetTime() {
  return currentTime().cast(SQLDataType.OFFSETTIME);
}

代码示例来源:origin: org.jooq/jooq

@Override
  final Field<BigDecimal> getFunction0(Configuration configuration) {
    switch (configuration.family()) {




      case FIREBIRD:
      case SQLITE:
        return argument.cast(BigDecimal.class).mul(pi()).div(inline(180));

      default:
        return function("radians", SQLDataType.NUMERIC, argument);
    }
  }
}

代码示例来源:origin: org.jooq/jooq

@Override
  public final void accept(Context<?> ctx) {
    switch (ctx.family()) {









      default:
        ctx.visit(field.cast(DECIMAL))
          .sql(" / ")
          .visit(DSL.sum(field));
        toSQLOverClause(ctx);
        break;
    }
  }
}

代码示例来源:origin: org.jooq/jooq

@Override
  final Field<BigDecimal> getFunction0(Configuration configuration) {
    switch (configuration.family()) {





      case FIREBIRD:
      case SQLITE:
        return argument.cast(BigDecimal.class).mul(inline(180)).div(pi());

      default:
        return DSL.field("{degrees}({0})", SQLDataType.NUMERIC, argument);
    }
  }
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

@Override
  final QueryPart getFunction0(Configuration configuration) {
    switch (configuration.dialect().family()) {
      case MYSQL:
      case MARIADB:
        return DSL.field("{" + name(getDataType()) + "}({0})", getDataType(), field);

      default:
      case H2:
        return field.cast(getDataType());
    }
  }
}

相关文章