@Documented
@Target(value=METHOD)
@Retention(value=RUNTIME)
public @interface QueryDelegate
Example :
@QueryDelegate(User.class)
public static Predicate like(QUser entity, User user) {
BooleanBuilder builder = new BooleanBuilder();
if (user.getFirstName() != null) {
builder.and(entity.firstName.eq(user.getFirstName()));
}
if (user.getLastName() != null) {
builder.and(entity.lastName.eq(user.getLastName()));
}
return builder.getValue();
}
This will be then available in the QUser type as an instance method without the first argument:
User user = new User(); user.setFirstName("John"); user.setLastName("Doe"); Predicate predicate = QUser.user.like(user);
Modifier and Type | Required Element and Description |
---|---|
java.lang.Class<?> |
value |
Copyright © 2007-2013 Mysema Ltd. All Rights Reserved.