本文整理汇总了Java中com.mysema.query.types.path.EntityPathBase类的典型用法代码示例。如果您正苦于以下问题:Java EntityPathBase类的具体用法?Java EntityPathBase怎么用?Java EntityPathBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EntityPathBase类属于com.mysema.query.types.path包,在下文中一共展示了EntityPathBase类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createListPredicate
import com.mysema.query.types.path.EntityPathBase; //导入依赖的package包/类
private static <T> Predicate createListPredicate(List<T> list, EntityPathBase<T> base) {
if (list == null || list.isEmpty()) {
return null;
}
if (list.size() == 1) {
return base.eq(list.get(0));
}
BooleanExpression expr = base.eq(list.get(0));
for (int i = 1; i < list.size(); i++) {
expr = expr.or(base.eq(list.get(i)));
}
return expr;
}
示例2: testAliasCandidate
import com.mysema.query.types.path.EntityPathBase; //导入依赖的package包/类
private void testAliasCandidate(Class<?> targetType, List<Path<?>> candidatePaths, Object candidate) {
if (candidate instanceof CollectionPathBase) {
Field elementTypeField = ReflectionUtils.findField(candidate.getClass(), "elementType");
Class<?> elementType = (Class<?>) getField(elementTypeField, candidate);
if (elementType.isAssignableFrom(targetType)) {
candidatePaths.add((Path<?>) candidate);
}
} else if (candidate instanceof EntityPathBase) {
Class<?> type = ((EntityPathBase) candidate).getType();
if (type.isAssignableFrom(targetType)) {
candidatePaths.add((Path<?>) candidate);
}
}
}
示例3: addPagingAndSorting
import com.mysema.query.types.path.EntityPathBase; //导入依赖的package包/类
public static void addPagingAndSorting(JPQLQuery query,
ExtDirectStoreReadRequest request, Class<?> clazz,
EntityPathBase<?> entityPathBase, Map<String, String> mapGuiColumn2Dbfield,
Set<String> sortIgnoreProperties) {
if (request.getStart() != null && request.getLimit() != null
&& request.getLimit() > 0) {
query.offset(request.getStart()).limit(request.getLimit());
}
addSorting(query, request, clazz, entityPathBase, mapGuiColumn2Dbfield,
sortIgnoreProperties);
}
示例4: addSorting
import com.mysema.query.types.path.EntityPathBase; //导入依赖的package包/类
public static void addSorting(JPQLQuery query, ExtDirectStoreReadRequest request,
Class<?> clazz, EntityPathBase<?> entityPathBase,
Map<String, String> mapGuiColumn2Dbfield, Set<String> sortIgnoreProperties) {
if (!request.getSorters().isEmpty()) {
query.orderBy(createOrderSpecifiers(request, clazz, entityPathBase,
mapGuiColumn2Dbfield, sortIgnoreProperties));
}
}
示例5: createOrderSpecifiers
import com.mysema.query.types.path.EntityPathBase; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
public static OrderSpecifier[] createOrderSpecifiers(
ExtDirectStoreReadRequest request, Class<?> clazz,
EntityPathBase<?> entityPathBase, Map<String, String> mapGuiColumn2Dbfield,
Set<String> sortIgnoreProperties) {
List<OrderSpecifier> orders;
if (!request.getSorters().isEmpty()) {
orders = new ArrayList<>();
PathBuilder<?> entityPath = new PathBuilder<>(clazz,
entityPathBase.getMetadata());
for (SortInfo sortInfo : request.getSorters()) {
if (!sortIgnoreProperties.contains(sortInfo.getProperty())) {
Order order;
if (sortInfo.getDirection() == SortDirection.ASCENDING) {
order = Order.ASC;
}
else {
order = Order.DESC;
}
String property = mapGuiColumn2Dbfield.get(sortInfo.getProperty());
if (property == null) {
property = sortInfo.getProperty();
}
orders.add(new OrderSpecifier(order, entityPath.get(property)));
}
}
}
else {
orders = Collections.emptyList();
}
return orders.toArray(new OrderSpecifier[orders.size()]);
}
示例6: toDSL
import com.mysema.query.types.path.EntityPathBase; //导入依赖的package包/类
protected <D extends BaseEntity, D2 extends EntityPathBase<D>> D2 toDSL(Path<?> path, Class<D2> dslEntityClass) {
try {
return dslEntityClass.getDeclaredConstructor(Path.class).newInstance(path);
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException |
InvocationTargetException | NoSuchMethodException | SecurityException e) {
AbstractDAO.log.error(e.getMessage(), e);
}
return null;
}
示例7: getOrderSpecifier
import com.mysema.query.types.path.EntityPathBase; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private Optional<OrderSpecifier> getOrderSpecifier(QueryParameters parameters, Expression<?>... args) {
final String sortColumn = parameters.getSortColumn();
final String sortDirection = parameters.getSortDirection();
if (StringUtils.hasText(sortColumn) && StringUtils.hasText(sortDirection)) {
Order order = (Sort.Direction.ASC.compareTo(pageableFactory.getDirection(sortDirection)) == 0) ? Order.ASC : Order.DESC;
return Optional.of(new OrderSpecifier(order, new EntityPathBase(args[0].getType(), suppressUniquePrefixIfAny(sortColumn))));
}
return Optional.absent();
}