本文整理了Java中org.jooq.Record.into
方法的一些代码示例,展示了Record.into
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Record.into
方法的具体详情如下:
包路径:org.jooq.Record
类名称:Record
方法名:into
[英]Map resulting records onto a custom type.
This will map this record onto your custom type using a RecordMapper as provided by Configuration#recordMapperProvider(). If no custom provider is specified, the DefaultRecordMapperProvider is used.
[中]将结果记录映射到自定义类型。
这将使用配置#recordMapperProvider()提供的RecordMapper将此记录映射到自定义类型。如果未指定自定义提供程序,则使用DefaultRecordMapperProvider。
代码示例来源:origin: stackoverflow.com
Map<Record, Result<Record>> result =
dsl.selectFrom(...).fetch().intoGroups(CHEST.fields());
List<Chest> list = new ArrayList<>();
for (Entry<Record, Result<Record>> entry : result.entrySet()) {
Record chest = entry.getKey();
Result<Record> drawers = entry.getValue();
list.add(new Chest(
chest.into(Id.class), // These into(Class<?>) methods assume that you
drawers.into(Drawer.class) // want to use jOOQ's DefaultRecordMapper
));
}
代码示例来源:origin: org.jooq/jooq
@Override
public final <S extends Record, T extends Record> Map<S, T> intoMap(Table<S> keyTable, Table<T> valueTable) {
Map<S, T> map = new LinkedHashMap<S, T>();
for (R record : this) {
S key = record.into(keyTable);
T value = record.into(valueTable);
if (map.put(key, value) != null)
throw new InvalidResultException("Key list " + key + " is not unique in Result for " + this);
}
return map;
}
代码示例来源:origin: org.jooq/jooq
@Override
public final <E> E fetchOneInto(Class<? extends E> type) {
R record = fetchOne();
return record == null ? null : record.into(type);
}
代码示例来源:origin: org.jooq/jooq
@Override
public final <Z extends Record> Z fetchOneInto(Table<Z> table) {
R record = fetchOne();
return record == null ? null : record.into(table);
}
代码示例来源:origin: org.jooq/jooq
private final void end(RecordContext ctx) {
Record record = ctx.record();
// TODO: [#2536] Use mapper()
if (record != null)
record.into(mapping.get(record));
}
代码示例来源:origin: org.jooq/jooq
@Override
public final <Z extends Record> Z fetchAnyInto(Table<Z> table) {
R record = fetchAny();
return record == null ? null : record.into(table);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
@Override
public final <E> E fetchOneInto(Class<? extends E> clazz) {
R record = fetchOne();
return record == null ? null : record.into(clazz);
}
代码示例来源:origin: org.jooq/jooq
@Override
public final <E> E fetchNextInto(Class<? extends E> clazz) {
R record = fetchNext();
return record == null ? null : record.into(clazz);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
@Override
public final <Z extends Record> Z fetchOneInto(Table<Z> table) {
R record = fetchOne();
return record == null ? null : record.into(table);
}
代码示例来源:origin: org.jooq/jooq
@Override
public final <S extends Record> Map<S, R> intoMap(Table<S> table) {
Map<S, R> map = new LinkedHashMap<S, R>();
for (R record : this) {
S key = record.into(table);
if (map.put(key, record) != null)
throw new InvalidResultException("Key list " + key + " is not unique in Result for " + this);
}
return map;
}
代码示例来源:origin: org.jooq/jooq
@Override
public final <E> E fetchAnyInto(Class<? extends E> type) {
R record = fetchAny();
return record == null ? null : record.into(type);
}
代码示例来源:origin: org.jooq/jooq
@Override
public final <E, S extends Record> Map<S, E> intoMap(Table<S> table, RecordMapper<? super R, E> mapper) {
Map<S, E> map = new LinkedHashMap<S, E>();
for (R record : this) {
S key = record.into(table);
if (map.put(key, mapper.map(record)) != null)
throw new InvalidResultException("Key list " + key + " is not unique in Result for " + this);
}
return map;
}
代码示例来源:origin: org.jooq/jooq
@Override
public final <S extends Record, T extends Record> Map<S, Result<T>> intoGroups(Table<S> keyTable, Table<T> valueTable) {
Map<S, Result<T>> map = new LinkedHashMap<S, Result<T>>();
for (R record : this) {
S key = record.into(keyTable);
T value = record.into(valueTable);
Result<T> result = map.get(key);
if (result == null)
map.put(key, result = DSL.using(configuration()).newResult(valueTable));
result.add(value);
}
return map;
}
代码示例来源:origin: org.jooq/jooq
@Override
public final <S extends Record> Map<S, Result<R>> intoGroups(Table<S> table) {
Map<S, Result<R>> map = new LinkedHashMap<S, Result<R>>();
for (R record : this) {
S key = record.into(table);
Result<R> result = map.get(key);
if (result == null)
map.put(key, result = new ResultImpl<R>(configuration(), this.fields));
result.add(record);
}
return map;
}
代码示例来源:origin: org.jooq/jooq
@Override
public final Result<Record> into(Field<?>... f) {
Result<Record> result = new ResultImpl<Record>(Tools.configuration(this), f);
for (Record record : this)
result.add(record.into(f));
return result;
}
代码示例来源:origin: k55k32/cms-admin-end
@Override
public Optional<T> getOptional(ID id) {
Record record = getDSLContext().select().from(table).where(primaryKey.eq(id)).fetchOne();
return Optional.ofNullable(record).map(r -> r.into(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;
}
代码示例来源:origin: k55k32/cms-admin-end
public List<ArticleTag> findTags(Collection<String> articleIds) {
List<ArticleTag> tags = dao.execute(e -> {
return e.select(Fields.all(C_TAG.fields(), C_ARTICLE_TAG.fields())).from(C_ARTICLE_TAG)
.leftJoin(C_TAG).on(C_TAG.ID.eq(C_ARTICLE_TAG.TAG_ID))
.where(C_ARTICLE_TAG.ARTICLE_ID.in(articleIds))
.fetch(r -> {
ArticleTag articleTag = r.into(ArticleTag.class);
articleTag.setTag(r.into(Tag.class));
return articleTag;
});
});
return tags;
}
代码示例来源:origin: rancher/cattle
@Override
public Service getServiceByServiceIndexId(long serviceIndexId) {
Record record = create()
.select(SERVICE.fields())
.from(SERVICE)
.join(SERVICE_INDEX).on(SERVICE.ID.eq(SERVICE_INDEX.SERVICE_ID))
.where(SERVICE_INDEX.ID.eq(serviceIndexId))
.fetchAny();
return record == null ? null : record.into(Service.class);
}
代码示例来源:origin: rancher/cattle
@Override
public Volume findVolumeByExternalId(Long storagePoolId, String externalId) {
Record record = create()
.select(VOLUME.fields())
.from(VOLUME)
.join(VOLUME_STORAGE_POOL_MAP)
.on(VOLUME_STORAGE_POOL_MAP.STORAGE_POOL_ID.eq(storagePoolId))
.where(VOLUME.EXTERNAL_ID.eq(externalId)
.or(VOLUME.EXTERNAL_ID.eq(VolumeUtils.externalId(externalId)))
.and((VOLUME.REMOVED.isNull().or(VOLUME.STATE.eq(CommonStatesConstants.REMOVING)))))
.fetchAny();
return record == null ? null : record.into(VolumeRecord.class);
}
内容来源于网络,如有侵权,请联系作者删除!