org.jooq.Table.fields()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(98)

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

Table.fields介绍

暂无

代码示例

代码示例来源:origin: my2iu/Jinq

@Override
public int getNumColumns()
{
 return table.fields().length;
}

代码示例来源:origin: my2iu/Jinq

public <U> RowReader<U> getReaderForField(Field<?> field)
{
 Field<?>[] fields = table.fields(); 
 for (int idx = 0; idx < fields.length; idx++)
 {
   Field<?> f = fields[idx];
   if (f == field)
    return new SimpleRowReader<>();
 }
 throw new IllegalArgumentException("Unknown field");
}

代码示例来源:origin: my2iu/Jinq

@Override
public T readResult(Record record, int offset)
{
 T toReturn;
 try {
   toReturn = constructor.newInstance();
 } catch (Exception e) {
   throw new IllegalArgumentException("Cannot construct class " + table.getRecordType().getName());
 }
 Field<?>[] fields = table.fields(); 
 for (int idx = 0; idx < fields.length; idx++)
 {
   Field<?> f = fields[idx];
   copyValueIntoRecord(toReturn, record, f, idx);
 }
 return toReturn;
}

代码示例来源:origin: my2iu/Jinq

public int getIndexForField(Field<?> field)
  {
   Field<?>[] fields = table.fields();
   int colIndex = 0;
   for (int idx = 0; idx < fields.length; idx++)
   {
     Field<?> f = fields[idx];
     if (f == field)
      return colIndex;
     colIndex += getReaderForField(field).getNumColumns();
   }
   throw new IllegalArgumentException("Unknown field");
  }
}

代码示例来源:origin: my2iu/Jinq

private void findMetamodelGetters(Schema schema)
{
 for (Table<?> table: schema.getTables())
 {
   String recordClassName = Type.getInternalName(table.getRecordType());
   for (Field<?> field: table.fields())
   {
    String name = field.getName();
    String getterName = "get" + name.substring(0, 1).toUpperCase() + name.substring(1).toLowerCase();
    MethodSignature methodSig = new MethodSignature(
       recordClassName,
       getterName,
       Type.getMethodDescriptor(Type.getType(field.getType())));
    fieldMethods.put(methodSig, field);
   }
 }
}

代码示例来源:origin: my2iu/Jinq

@Override
public ColumnExpressions<?> handleArg(int argIndex, Type argType) throws TypedValueVisitorException
{
 if (argIndex < numLambdaCapturedArgs)
 {
   // Currently, we only support parameters of a few small simple types.
   // We should also support more complex types (e.g. entities) and allow
   // fields/methods of those entities to be called in the query (code
   // motion will be used to push those field accesses or method calls
   // outside the query where they will be evaluated and then passed in
   // as a parameter)
   if (!ALLOWED_QUERY_PARAMETER_TYPES.contains(argType))
    throw new TypedValueVisitorException("Accessing a field with unhandled type");
   return ColumnExpressions.singleColumn(new SimpleRowReader<>(), DSL.val(lambda.getCapturedArg(argIndex)));
 }
 else
 {
   Table<?> table = fromList.get(argIndex - numLambdaCapturedArgs);
   // TODO: Should this return a single column or all the columns of the table?
   ColumnExpressions<?> columns = new ColumnExpressions<>(new TableRowReader<>(table));
   for (Field<?> field: table.fields())
    columns.columns.add(field);
   return columns;
 }
}

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

@Override
public final InsertImpl columns(Field<?>... f) {
  this.fields = (f == null || f.length == 0) ? into.fields() : f;
  return this;
}

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

InsertSelectQueryImpl(Configuration configuration, Table<?> into, Field<?>[] fields, Select<?> select) {
  super(configuration);
  this.into = into;
  this.fields = (fields == null || fields.length == 0) ? into.fields() : fields;
  this.select = select;
}

代码示例来源:origin: rancher/cattle

@SuppressWarnings("unchecked")
private Field<Date> getRemoveField(Table<?> table) {
  for (String fieldName : TIMESTAMP_FIELD_NAME_PRECEDENCE) {
    for (Field<?> field : table.fields()) {
      if (fieldName.equals(field.getName())) {
        return (Field<Date>) field;
      }
    }
  }
  return null;
}

代码示例来源:origin: rancher/cattle

@SuppressWarnings("unchecked")
private Field<Long> getIdField(Table<?> table) {
  for (Field<?> field : table.fields()) {
    if (field.getName().equals("id")) {
      return (Field<Long>) field;
    }
  }
  return null;
}

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

@Override
  final Fields<R> fields0() {
    return new Fields<R>(table.fields());
  }
}

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

QueryPartList<Field<?>> getUpsertFields() {
  if (upsertFields == null)
    upsertFields = new QueryPartList<Field<?>>(table.fields());
  return upsertFields;
}

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

InsertImpl(Configuration configuration, Table<R> into, Collection<? extends Field<?>> fields) {
  super(new InsertQueryImpl<R>(configuration, into));
  this.into = into;
  this.fields = (fields == null || fields.size() == 0)
    ? into.fields()
    : fields.toArray(new Field[fields.size()]);
}

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

@Override
  final Fields<R> fields0() {
    return new Fields<R>(table.fields());
  }
}

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

@Override
final Fields<Record> fields0() {
  Field<?>[] l = lhs.asTable().fields();
  Field<?>[] r = rhs.asTable().fields();
  Field<?>[] all = new Field[l.length + r.length];
  System.arraycopy(l, 0, all, 0, l.length);
  System.arraycopy(r, 0, all, l.length, r.length);
  return new Fields<Record>(all);
}

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

/**
 * Create a new record
 */
@SuppressWarnings("unchecked")
static final <R extends Record> RecordDelegate<R> newRecord(boolean fetched, Table<R> type, Configuration configuration) {
  return (RecordDelegate<R>) newRecord(fetched, type.getRecordType(), type.fields(), configuration);
}

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

@Override
final Fields<Record> fields0() {
  List<Field<?>> fields = new ArrayList<Field<?>>();
  for (Table<?> table : tables)
    for (Field<?> field : table.fields())
      fields.add(DSL.field(DSL.name(field.getName()), field.getDataType()));
  return new Fields<Record>(fields);
}

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

RenamedTable(Table<R> delegate, String rename) {
    super(rename, delegate.getSchema());

    for (Field<?> field : delegate.fields()) {
      createField(field.getName(), field.getDataType(), this);
    }
  }
}

代码示例来源:origin: k55k32/cms-admin-end

@Override
public PageResult<T> fetch(PageResult<T> page, Stream<Condition> conditions, SortField<?>... sorts) {
  Condition c = conditions.reduce((acc, item) -> acc.and(item)).orElse(DSL.trueCondition());
  return fetch(page, e -> {
    return e.select(table.fields()).from(table).where(c).orderBy(sorts);
  }, entityClass);
}

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

@Override
public final <Z extends Record> Result<Z> into(Table<Z> table) {
  Result<Z> list = new ResultImpl<Z>(configuration(), table.fields());
  for (R record : this)
    list.add(record.into(table));
  return list;
}

相关文章