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

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

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

Table.fields介绍

暂无

代码示例

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

  1. @Override
  2. public int getNumColumns()
  3. {
  4. return table.fields().length;
  5. }

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

  1. public <U> RowReader<U> getReaderForField(Field<?> field)
  2. {
  3. Field<?>[] fields = table.fields();
  4. for (int idx = 0; idx < fields.length; idx++)
  5. {
  6. Field<?> f = fields[idx];
  7. if (f == field)
  8. return new SimpleRowReader<>();
  9. }
  10. throw new IllegalArgumentException("Unknown field");
  11. }

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

  1. @Override
  2. public T readResult(Record record, int offset)
  3. {
  4. T toReturn;
  5. try {
  6. toReturn = constructor.newInstance();
  7. } catch (Exception e) {
  8. throw new IllegalArgumentException("Cannot construct class " + table.getRecordType().getName());
  9. }
  10. Field<?>[] fields = table.fields();
  11. for (int idx = 0; idx < fields.length; idx++)
  12. {
  13. Field<?> f = fields[idx];
  14. copyValueIntoRecord(toReturn, record, f, idx);
  15. }
  16. return toReturn;
  17. }

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

  1. public int getIndexForField(Field<?> field)
  2. {
  3. Field<?>[] fields = table.fields();
  4. int colIndex = 0;
  5. for (int idx = 0; idx < fields.length; idx++)
  6. {
  7. Field<?> f = fields[idx];
  8. if (f == field)
  9. return colIndex;
  10. colIndex += getReaderForField(field).getNumColumns();
  11. }
  12. throw new IllegalArgumentException("Unknown field");
  13. }
  14. }

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

  1. private void findMetamodelGetters(Schema schema)
  2. {
  3. for (Table<?> table: schema.getTables())
  4. {
  5. String recordClassName = Type.getInternalName(table.getRecordType());
  6. for (Field<?> field: table.fields())
  7. {
  8. String name = field.getName();
  9. String getterName = "get" + name.substring(0, 1).toUpperCase() + name.substring(1).toLowerCase();
  10. MethodSignature methodSig = new MethodSignature(
  11. recordClassName,
  12. getterName,
  13. Type.getMethodDescriptor(Type.getType(field.getType())));
  14. fieldMethods.put(methodSig, field);
  15. }
  16. }
  17. }

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

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

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

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

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

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

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

  1. @SuppressWarnings("unchecked")
  2. private Field<Date> getRemoveField(Table<?> table) {
  3. for (String fieldName : TIMESTAMP_FIELD_NAME_PRECEDENCE) {
  4. for (Field<?> field : table.fields()) {
  5. if (fieldName.equals(field.getName())) {
  6. return (Field<Date>) field;
  7. }
  8. }
  9. }
  10. return null;
  11. }

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

  1. @SuppressWarnings("unchecked")
  2. private Field<Long> getIdField(Table<?> table) {
  3. for (Field<?> field : table.fields()) {
  4. if (field.getName().equals("id")) {
  5. return (Field<Long>) field;
  6. }
  7. }
  8. return null;
  9. }

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

  1. @Override
  2. final Fields<R> fields0() {
  3. return new Fields<R>(table.fields());
  4. }
  5. }

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

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

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

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

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

  1. @Override
  2. final Fields<R> fields0() {
  3. return new Fields<R>(table.fields());
  4. }
  5. }

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

  1. @Override
  2. final Fields<Record> fields0() {
  3. Field<?>[] l = lhs.asTable().fields();
  4. Field<?>[] r = rhs.asTable().fields();
  5. Field<?>[] all = new Field[l.length + r.length];
  6. System.arraycopy(l, 0, all, 0, l.length);
  7. System.arraycopy(r, 0, all, l.length, r.length);
  8. return new Fields<Record>(all);
  9. }

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

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

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

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

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

  1. RenamedTable(Table<R> delegate, String rename) {
  2. super(rename, delegate.getSchema());
  3. for (Field<?> field : delegate.fields()) {
  4. createField(field.getName(), field.getDataType(), this);
  5. }
  6. }
  7. }

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

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

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

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

相关文章