mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-27 21:01:15 +08:00
Merge pull request #1390 from querydsl/i1384
Add more Expressions.arrayPath variants
This commit is contained in:
commit
9543306df0
@ -1418,6 +1418,33 @@ public final class Expressions {
|
||||
return new MapPath<K,V,E>(keyType, valueType, queryType, metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new Path expression
|
||||
*
|
||||
* @param arrayType array type
|
||||
* @param variable variable name
|
||||
* @param <A> array type
|
||||
* @param <E> element type
|
||||
* @return path expression
|
||||
*/
|
||||
public static <A, E> ArrayPath<A, E> arrayPath(Class<A> arrayType, String variable) {
|
||||
return new ArrayPath<A, E>(arrayType, variable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new Path expression
|
||||
*
|
||||
* @param arrayType array type
|
||||
* @param parent path metadata
|
||||
* @param property property name
|
||||
* @param <A> array type
|
||||
* @param <E> element type
|
||||
* @return path expression
|
||||
*/
|
||||
public static <A, E> ArrayPath<A, E> arrayPath(Class<A> arrayType, Path<?> parent, String property) {
|
||||
return new ArrayPath<A, E>(arrayType, parent, property);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new Path expression
|
||||
*
|
||||
|
||||
@ -57,6 +57,11 @@ public class ExpressionsTest {
|
||||
assertReturnType(Expressions.class.getMethod(type + "Template", Class.class, Template.class, ImmutableList.class));
|
||||
}
|
||||
}
|
||||
|
||||
// arrays
|
||||
assertReturnType(Expressions.class.getMethod("arrayPath", Class.class, String.class));
|
||||
assertReturnType(Expressions.class.getMethod("arrayPath", Class.class, Path.class, String.class));
|
||||
assertReturnType(Expressions.class.getMethod("arrayPath", Class.class, PathMetadata.class));
|
||||
}
|
||||
|
||||
private void assertReturnType(Method method) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user