本文整理汇总了Java中com.querydsl.core.types.Path类的典型用法代码示例。如果您正苦于以下问题:Java Path类的具体用法?Java Path怎么用?Java Path使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Path类属于com.querydsl.core.types包,在下文中一共展示了Path类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: pathName
import com.querydsl.core.types.Path; //导入依赖的package包/类
/**
* Query name of given path. A dot-notation pattern is used to express nested properties path.
* @param path Path
* @return Path query name
*/
private static String pathName(Path<?> path) {
if (path != null) {
StringBuilder sb = new StringBuilder();
if (!path.getMetadata().isRoot()) {
Path<?> parent = path.getMetadata().getParent();
if (!parent.getMetadata().isRoot()) {
String parentName = pathName(parent);
if (parentName != null) {
sb.append(parentName);
sb.append(".");
}
}
}
sb.append(path.getMetadata().getName());
return sb.toString();
}
return null;
}
示例2: expressionsForProperty
import com.querydsl.core.types.Path; //导入依赖的package包/类
/**
* Get a Map of expressions for the given property and path. Add it to the
* given Map, or a new Map.
*
* @param property The property to get expressions for.
* @param qPath The path to get expressions for.
* @param target The Map to add to. If null a new Map will be created.
* @return The target Map, or a new Map if target was null.
*/
public static Map<String, Expression<?>> expressionsForProperty(EntityProperty property, Path<?> qPath, Map<String, Expression<?>> target) {
Map<Class, Map<String, ExpressionFactory>> innerMap = EP_MAP_MULTI.get(property);
if (innerMap == null) {
throw new IllegalArgumentException("We do not know any property called " + property.toString());
}
Map<String, ExpressionFactory> coreMap = innerMap.get(qPath.getClass());
if (coreMap == null) {
throw new IllegalArgumentException("No property called " + property.toString() + " for " + qPath.getClass());
}
if (target == null) {
target = new LinkedHashMap<>();
}
for (Map.Entry<String, ExpressionFactory> es : coreMap.entrySet()) {
target.put(es.getKey(), es.getValue().get(qPath));
}
return target;
}
示例3: applyPaginationWithPageableHavingAPropertyNotIncludedInTheAttributeMappingShouldNotFail
import com.querydsl.core.types.Path; //导入依赖的package包/类
/**
* Test method for {@link io.springlets.data.jpa.repository.support.QueryDslRepositorySupportExt#applyPagination(org.springframework.data.domain.Pageable, com.querydsl.jpa.JPQLQuery, java.util.Map)}.
*/
@Test
public void applyPaginationWithPageableHavingAPropertyNotIncludedInTheAttributeMappingShouldNotFail() {
// Prepare
Sort.Order order = new Sort.Order("test");
Map<String, Path<?>[]> attributeMapping = new HashMap<>();
when(pageable.getSort()).thenReturn(sort);
when(pageable.getPageSize()).thenReturn(1);
when(sort.iterator()).thenReturn(iterator);
when(iterator.hasNext()).thenReturn(true).thenReturn(false);
when(iterator.next()).thenReturn(order).thenThrow(new NoSuchElementException());
// Exercise & verify
support.applyPagination(pageable, null, attributeMapping);
}
示例4: DefaultQueryDslProperty
import com.querydsl.core.types.Path; //导入依赖的package包/类
/**
* Constructor
* @param path Property path (required not null)
*/
@SuppressWarnings("null")
public DefaultQueryDslProperty(Path<T> path) {
super(pathName(path), (path != null) ? path.getType() : null);
ObjectUtils.argumentNotNull(path, "Path must be not null");
this.path = path;
// set parent
if (path.getRoot() != null) {
parent(JpaTarget.of(path.getRoot().getType()));
}
}
示例5: getExpressions
import com.querydsl.core.types.Path; //导入依赖的package包/类
public static Expression<?>[] getExpressions(Path<?> qPath, Set<EntityProperty> selectedProperties) {
List<Expression<?>> exprList = new ArrayList<>();
if (selectedProperties.isEmpty()) {
PropertyResolver.expressionsForClass(qPath, exprList);
} else {
for (EntityProperty property : selectedProperties) {
PropertyResolver.expressionsForProperty(property, qPath, exprList);
}
}
return exprList.toArray(new Expression<?>[exprList.size()]);
}
示例6: expressionForProperty
import com.querydsl.core.types.Path; //导入依赖的package包/类
public static Expression<?> expressionForProperty(EntityProperty property, Path<?> qPath) {
Map<Class, ExpressionFactory> innerMap = EP_MAP_SINGLE.get(property);
if (innerMap == null) {
throw new IllegalArgumentException("ObservedProperty has no property called " + property.toString());
}
return innerMap.get(qPath.getClass()).get(qPath);
}
示例7: expressionsForClass
import com.querydsl.core.types.Path; //导入依赖的package包/类
/**
*
* @param qPath The path to get expressions for.
* @param target The list to add to. If null a new list will be created.
* @return The target list, or a new list if target was null.
*/
public static List<Expression<?>> expressionsForClass(Path<?> qPath, List<Expression<?>> target) {
List<ExpressionFactory> list = ALL_FOR_CLASS.get(qPath.getClass());
if (target == null) {
target = new ArrayList<>();
}
for (ExpressionFactory f : list) {
target.add(f.get(qPath));
}
return target;
}
示例8: SQSrvaMethod
import com.querydsl.core.types.Path; //导入依赖的package包/类
public SQSrvaMethod(Path<? extends SQSrvaMethod> path) {
super(path.getType(), path.getMetadata(), "public", "srva_method");
addMetadata();
}
示例9: QTest
import com.querydsl.core.types.Path; //导入依赖的package包/类
public QTest(Path<? extends Test> path) {
this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS));
}
示例10: getPath
import com.querydsl.core.types.Path; //导入依赖的package包/类
@Override
public Path<T> getPath() {
return path;
}
示例11: QSubNested
import com.querydsl.core.types.Path; //导入依赖的package包/类
public QSubNested(Path<? extends SubNested> path) {
super(path.getType(), path.getMetadata());
}
示例12: QTestJpaDomain
import com.querydsl.core.types.Path; //导入依赖的package包/类
public QTestJpaDomain(Path<? extends TestJpaDomain> path) {
this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS));
}
示例13: QTestOtherDomain
import com.querydsl.core.types.Path; //导入依赖的package包/类
public QTestOtherDomain(Path<? extends TestOtherDomain> path) {
super(path.getType(), path.getMetadata());
}
示例14: QTestNested
import com.querydsl.core.types.Path; //导入依赖的package包/类
public QTestNested(Path<? extends TestNested> path) {
this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS));
}
示例15: addInParameter
import com.querydsl.core.types.Path; //导入依赖的package包/类
public <T> StoredProcedureQueryBuilder addInParameter(Path<T> parameter, T value) {
Class type = parameter.getType();
inParameters.add(new Parameter(type, parameter.getMetadata().getName(), value));
return this;
}