本文整理了Java中com.mysema.query.types.Path.getRoot()
方法的一些代码示例,展示了Path.getRoot()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Path.getRoot()
方法的具体详情如下:
包路径:com.mysema.query.types.Path
类名称:Path
方法名:getRoot
[英]Get the root for this path
[中]获取此路径的根
代码示例来源:origin: com.mysema.querydsl/querydsl-core
@Override
public Set<Expression<?>> visit(Path<?> expr, Set<Expression<?>> known) {
if (!known.contains(expr.getRoot())) {
throw new IllegalArgumentException(String.format(errorTemplate, expr.getRoot()));
}
return known;
}
代码示例来源:origin: com.mysema.querydsl/querydsl-core
private <P extends Path<?>> P assertRoot(P p) {
if (!p.getRoot().equals(p)) {
throw new IllegalArgumentException(p + " is not a root path");
}
return p;
}
代码示例来源:origin: com.mysema.querydsl/querydsl-core
public PathMetadata(@Nullable Path<?> parent, Object element, PathType type) {
this.parent = parent;
this.element = element;
this.pathType = type;
this.root = parent != null ? parent.getRoot() : null;
this.hashCode = 31 * element.hashCode() + pathType.name().hashCode();
}
代码示例来源:origin: com.mysema.querydsl/querydsl-collections
/**
* Wrap a Querydsl predicate into a Guava predicate
*
* @param predicate
* @return
*/
public static <T> com.google.common.base.Predicate<T> wrap(Predicate predicate) {
Path<?> path = (Path<?>)predicate.accept(PathExtractor.DEFAULT, null);
if (path != null) {
final Evaluator<Boolean> ev = createEvaluator(path.getRoot(), predicate);
return new com.google.common.base.Predicate<T>() {
@Override
public boolean apply(T input) {
return ev.evaluate(input);
}
};
} else {
throw new IllegalArgumentException("No path in " + predicate);
}
}
代码示例来源:origin: com.mysema.querydsl/querydsl-collections
/**
* Wrap a Querydsl expression into a Guava function
*
* @param projection
* @return
*/
public static <F,T> Function<F,T> wrap(Expression<T> projection) {
Path<?> path = (Path<?>)projection.accept(PathExtractor.DEFAULT, null);
if (path != null) {
final Evaluator<T> ev = createEvaluator(path.getRoot(), projection);
return new Function<F,T>() {
@Override
public T apply(F input) {
return ev.evaluate(input);
}
};
} else {
throw new IllegalArgumentException("No path in " + projection);
}
}
代码示例来源:origin: org.neo4j/neo4j-cypher-dsl
public static StringProperty string( Path<?> entityPath )
{
return identifier(entityPath.getRoot().toString()).string( entityPath.getMetadata().getExpression().toString() );
}
代码示例来源:origin: org.neo4j/neo4j-cypher-dsl
public static NumberProperty number( Path<?> entityPath )
{
return identifier(entityPath.getRoot().toString()).number( entityPath.getMetadata().getExpression().toString() );
}
代码示例来源:origin: org.neo4j/neo4j-cypher-dsl
public static Property property( Path<?> entityPath )
{
return identifier(entityPath.getRoot().toString()).property( entityPath.getMetadata().getExpression().toString() );
}
代码示例来源:origin: com.mysema.querydsl/querydsl-mongodb
@Nullable
protected Predicate createJoinFilter(QueryMetadata metadata) {
Multimap<Expression<?>, Predicate> predicates = HashMultimap.<Expression<?>, Predicate>create();
List<JoinExpression> joins = metadata.getJoins();
for (int i = joins.size() - 1; i >= 0; i--) {
JoinExpression join = joins.get(i);
Path source = (Path)((Operation<?>)join.getTarget()).getArg(0);
Path target = (Path)((Operation<?>)join.getTarget()).getArg(1);
Collection<Predicate> extraFilters = predicates.get(target.getRoot());
Predicate filter = ExpressionUtils.allOf(join.getCondition(), allOf(extraFilters));
List<Object> ids = getIds(target.getType(), filter);
if (ids.isEmpty()) {
throw new NoResults();
}
Path path = new PathImpl<String>(String.class, source, "$id");
predicates.put(source.getRoot(), ExpressionUtils.in(path, ids));
}
Path source = (Path)((Operation)joins.get(0).getTarget()).getArg(0);
return allOf(predicates.get(source.getRoot()));
}
代码示例来源:origin: org.neo4j/neo4j-cypher-dsl
public Object arg(com.mysema.query.types.Expression expression)
{
if (expression instanceof Constant)
return ((Constant)expression).getConstant();
else if (expression instanceof ParamExpression)
return param( ( (ParamExpression) expression ).getName() );
else if (expression instanceof Path)
{
Path path = (Path) expression;
return identifier( path.getRoot()).string( path.getMetadata().getExpression().toString() );
}
else
throw new IllegalArgumentException("Unknown argument type:"+expression);
}
}, null ));
内容来源于网络,如有侵权,请联系作者删除!