use of io.crnk.core.queryspec.pagingspec.PagingBehavior in project crnk-framework by crnk-project.
the class CrnkBoot method setupPagingBehavior.
private void setupPagingBehavior() {
if (moduleRegistry.getPagingBehaviors().isEmpty()) {
setupServiceDiscovery();
moduleRegistry.addAllPagingBehaviors(serviceDiscovery.getInstancesByType(PagingBehavior.class));
if (moduleRegistry.getPagingBehaviors().isEmpty()) {
moduleRegistry.addPagingBehavior(new OffsetLimitPagingBehavior());
}
}
for (PagingBehavior pagingBehavior : moduleRegistry.getPagingBehaviors()) {
if (pagingBehavior instanceof OffsetLimitPagingBehavior) {
if (defaultPageLimit != null) {
((OffsetLimitPagingBehavior) pagingBehavior).setDefaultLimit(defaultPageLimit);
}
if (maxPageLimit != null) {
((OffsetLimitPagingBehavior) pagingBehavior).setMaxPageLimit(maxPageLimit);
}
}
}
}
Aggregations