@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);
public abstract Class<?> value
Copyright © 2007–2016 Querydsl. All rights reserved.