本文整理汇总了Java中org.jooq.RecordMapper类的典型用法代码示例。如果您正苦于以下问题:Java RecordMapper类的具体用法?Java RecordMapper怎么用?Java RecordMapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RecordMapper类属于org.jooq包,在下文中一共展示了RecordMapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: InsertReturning
import org.jooq.RecordMapper; //导入依赖的package包/类
private InsertReturning(
Connection connection,
InsertReturningQueryBuilder<? extends InsertResultStep<? extends R>> queryBuilder,
RecordMapper<? super R, ? extends T> recordMapper
) {
super(
subscriber -> {
try (InsertResultStep<? extends R> query = queryBuilder.build(connection)) {
Iterable<? extends R> result = query.fetch();
setupUnsubscription(subscriber, query);
log.debug("InsertReturning setProducer for {}", query);
subscriber.setProducer(
new InsertReturningProducer<>(
subscriber,
query,
result,
recordMapper
)
);
} catch (Throwable t) {
handleException(t, subscriber);
}
}
);
}
示例2: Select
import org.jooq.RecordMapper; //导入依赖的package包/类
private Select(
Connection connection,
QueryBuilder<ResultQuery<? extends R>> queryBuilder,
RecordMapper<? super R, ? extends T> recordMapper
) {
super(
subscriber -> {
try (ResultQuery<? extends R> query = queryBuilder.build(connection)) {
Cursor<? extends R> cursor = query.fetchLazy();
setupUnsubscription(subscriber, query, cursor);
log.debug("Select setProducer for {}", query);
subscriber.setProducer(new SelectProducer<>(
subscriber,
query,
cursor,
recordMapper
));
} catch (Throwable t) {
handleException(t, subscriber);
}
}
);
}
示例3: getLevel
import org.jooq.RecordMapper; //导入依赖的package包/类
public Level getLevel(int id) {
Level level = create.select().from(LEVELS).where(LEVELS.ID.eq(id)).fetchOne().into(Level.class);
List<EntityBlock> blocks = create.select().from(LEVEL_MAP).where(LEVEL_MAP.ID.eq(level.getId())).fetch().map(new RecordMapper<Record, EntityBlock>() {
@Override
public EntityBlock map(Record record) {
return new EntityBlock(record.getValue(LEVEL_MAP.X).intValue(),
record.getValue(LEVEL_MAP.Y).intValue(),
record.getValue(LEVEL_MAP.WIDTH).intValue(),
record.getValue(LEVEL_MAP.HEIGHT).intValue(),
getPowerUp(record.getValue(LEVEL_MAP.POWERUPTYPE).intValue()));
}
});
level.setBlockList(blocks);
System.out.println(blocks);
return level;
}
示例4: getLevels
import org.jooq.RecordMapper; //导入依赖的package包/类
public List<Level> getLevels() {
List<Level> levels = create.select().from(LEVELS).fetch().into(Level.class);
for (Level level : levels) {
List<EntityBlock> blocks = create.select().from(LEVEL_MAP).where(LEVEL_MAP.ID.eq(level.getId())).fetch().map(new RecordMapper<Record, EntityBlock>() {
@Override
public EntityBlock map(Record record) {
return new EntityBlock(record.getValue(LEVEL_MAP.X).intValue(),
record.getValue(LEVEL_MAP.Y).intValue(),
record.getValue(LEVEL_MAP.WIDTH).intValue(),
record.getValue(LEVEL_MAP.HEIGHT).intValue(),
getPowerUp(record.getValue(LEVEL_MAP.POWERUPTYPE).intValue()));
}
});
level.setBlockList(blocks);
}
return levels;
}
示例5: getMPHightScores
import org.jooq.RecordMapper; //导入依赖的package包/类
public List<MPGame> getMPHightScores() {
List<MPGame> games = create.select().from(MPGAMES).fetch().map(new RecordMapper<Record, MPGame>() {
@Override
public MPGame map(Record record) {
MpgamesRecord mpgamesRecord = (MpgamesRecord) record;
return new MPGame(getMPPlayer(mpgamesRecord.getPlayer1()), getMPPlayer(mpgamesRecord.getPlayer2()));
}
});
Collections.sort(games, new Comparator<MPGame>() {
@Override
public int compare(MPGame game1, MPGame game2) {
return game2.getTotalScore() - game1.getTotalScore();
}
});
return games;
}
示例6: getQuestionMapper
import org.jooq.RecordMapper; //导入依赖的package包/类
private RecordMapper<Record, QuestionView> getQuestionMapper(final QuestionContent questionContent) {
return record -> {
final QuestionView questionView = new QuestionView();
questionView.setQuestionId(record.getValue(QUESTIONS.QUESTION_ID));
questionView.setCreated(record.getValue(QUESTIONS.CREATED).toLocalDateTime());
questionView.setUser(
new UserView(record.getValue(USERS.LOGIN),
record.getValue(PROFILES.FIRST_NAME),
record.getValue(PROFILES.LAST_NAME),
record.getValue(PROFILES.NICKNAME))
);
questionView.setGroupCode(record.getValue(CONTESTS.CODE));
questionView.setProblemCode(record.getValue(TASKS.CODE));
questionView.setStatus(record.getValue(QUESTIONS.STATUS));
questionView.setType();
if (QuestionContent.WITH_CONTENT.equals(questionContent)) {
questionView.setContent(record.getValue(QUESTIONS.QUESTION));
}
questionView.setPrivateQuestion(record.getValue(QUESTIONS.PRIVATE));
questionView.setAnswersCount(record.getValue("answersCount", Integer.class));
if (record.field("hasNotification") != null) {
questionView.setHasNotification(record.getValue("hasNotification", Boolean.class));
}
return questionView;
};
}
示例7: using
import org.jooq.RecordMapper; //导入依赖的package包/类
public static <R extends Record, T> InsertReturning<R, T> using(
Connection connection,
InsertReturningQueryBuilder<? extends InsertResultStep<? extends R>> queryBuilder,
RecordMapper<? super R, ? extends T> recordMapper
) {
return new InsertReturning<>(connection, queryBuilder, recordMapper);
}
示例8: SelectProducer
import org.jooq.RecordMapper; //导入依赖的package包/类
public SelectProducer(
Subscriber<? super T> subscriber,
ResultQuery<? extends R> query,
Cursor<? extends R> cursor,
RecordMapper<? super R, ? extends T> recordMapper
) {
this.subscriber = subscriber;
this.query = query;
this.cursor = cursor;
this.recordMapper = recordMapper;
}
示例9: InsertReturningProducer
import org.jooq.RecordMapper; //导入依赖的package包/类
public InsertReturningProducer(
Subscriber<? super T> subscriber,
Query query,
Iterable<? extends R> result,
RecordMapper<? super R, ? extends T> recordMapper
) {
this.subscriber = subscriber;
this.query = query;
this.result = result.iterator();
this.recordMapper = recordMapper;
}
示例10: beforeClass
import org.jooq.RecordMapper; //导入依赖的package包/类
@BeforeClass
public void beforeClass() {
recordMapper = new RecordMapper<Record, User>() {
@Override public User map(Record record) {
return mapper.map(record, User.class);
}
};
}
示例11: using
import org.jooq.RecordMapper; //导入依赖的package包/类
public static <R extends Record, T> Select<R, T> using(Connection connection,
QueryBuilder<ResultQuery<? extends R>> queryBuilder,
RecordMapper<? super R, ? extends T> recordMapper) {
return new Select<>(connection, queryBuilder, recordMapper);
}
示例12: provide
import org.jooq.RecordMapper; //导入依赖的package包/类
@Override
public <R extends Record, E> RecordMapper<R, E> provide(RecordType<R> recordType,
Class<? extends E> aClass) {
return null;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:6,代码来源:JooqAutoConfigurationTests.java
示例13: getProblemDetailMapper
import org.jooq.RecordMapper; //导入依赖的package包/类
private RecordMapper<Record, ProblemDetailView> getProblemDetailMapper(final boolean extendInfo) {
return record -> {
ProblemDetailView p = new ProblemDetailView();
p.setId(record.getValue(TASKS.TASK_ID));
p.setCode(record.getValue(TASKS.CODE));
p.setName(record.getValue(TASKS.NAME));
Optional.ofNullable(record.getValue(TASKS.CONTENT)).ifPresent(p::setContent);
if (!extendInfo && record.field(TRANSLATIONS.TRANSLATION) != null) {
Optional.ofNullable(record.getValue(TRANSLATIONS.TRANSLATION)).ifPresent(p::setContent);
}
p.setHasAttachment(!StringUtils.isEmpty(record.getValue(TASKS.FILETYPE)));
if (extendInfo) {
p.setCheckerSource(record.getValue(TASKS.CHECKSRC));
p.setDefaultTimeLimit(record.getValue(TASKS.DEFAULT_TIME_LIMIT));
p.setDefaultMemoryLimit(record.getValue(TASKS.DEFAULT_MEMORY_LIMIT));
p.setAuthor(record.getValue(TASKS.AUTHOR));
}
if (record.field(submissionsCountField) != null) {
final Optional<Integer> totalCount =
Optional.ofNullable(record.getValue(submissionsCountField));
totalCount.ifPresent(p::setSubmissionsCount);
}
if (record.field("acceptRatio") != null) {
final Optional<Float> acceptRatio =
Optional.ofNullable(record.getValue("acceptRatio", Float.class));
acceptRatio.ifPresent(p::setAcceptRatio);
}
if (record.field(submissionsCountLastWeekField) != null) {
final Optional<Integer> totalLastWeekCount =
Optional.ofNullable(record.getValue(submissionsCountLastWeekField));
totalLastWeekCount.ifPresent(p::setSubmissionsCount);
}
return p;
};
}
示例14: getUserGroups
import org.jooq.RecordMapper; //导入依赖的package包/类
private void getUserGroups(final UserDetailView userDetailView,
final String login) {
UserGroupsView userGroupsView = new UserGroupsView();
userDetailView.setGroups(userGroupsView);
final List<UserGroupView> finalised = new LinkedList<>();
final List<UserGroupView> current = new LinkedList<>();
final List<UserGroupView> future = new LinkedList<>();
userGroupsView.setFinalised(finalised);
userGroupsView.setCurrent(current);
userGroupsView.setFuture(future);
final Field<Timestamp> currentTimestamp = DSL.currentTimestamp();
jooq.select(TEAMS.CODE,
TEAMS.NAME,
TEAMS_CONTESTS.STATUS,
CONTESTS.CODE,
CONTESTS.NAME,
CONTESTS.CONTEST_START,
CONTESTS.CONTEST_END,
currentTimestamp)
.from(TEAMS, TEAMS_CONTESTS, CONTESTS)
.where(TEAMS_CONTESTS.TEAM_ID.in(DSL.select(USERS.TEAM_ID)
.from(USERS)
.where(USERS.LOGIN
.eq(login))))
.and(TEAMS_CONTESTS.CONTEST_ID.eq(CONTESTS.CONTEST_ID))
.and(TEAMS_CONTESTS.TEAM_ID.eq(TEAMS.TEAM_ID))
.orderBy(CONTESTS.NAME)
.fetch()
.map(new RecordMapper<Record, UserGroupView>() {
@Override
public UserGroupView map(final Record record) {
UserGroupView userGroupView = new UserGroupView();
userGroupView.setCode(record.getValue(CONTESTS.CODE));
userGroupView.setName(record.getValue(CONTESTS.NAME));
final Timestamp currentTime = record.getValue(currentTimestamp);
final Timestamp contestStart = record.getValue(CONTESTS.CONTEST_START);
final Timestamp contestEnd = record.getValue(CONTESTS.CONTEST_END);
if (contestEnd == null || (contestEnd.after(currentTime) && contestStart != null && contestStart.before(currentTime))) {
current.add(userGroupView);
} else if (contestEnd.before(currentTime)) {
finalised.add(userGroupView);
} else {
future.add(userGroupView);
}
return userGroupView;
}
});
}
示例15: mapper
import org.jooq.RecordMapper; //导入依赖的package包/类
/**
* Returns the {@link RecordMapper}.
* <p>
* Subclasses may override this method to provide custom implementations.
* </p>
*
* @return the record mapper
*/
protected RecordMapper<R, E> mapper() {
return mapper;
}