New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide adapters for Guava Predicates #172

Closed
olivergierke opened this Issue Jun 12, 2012 · 2 comments

Comments

Projects
None yet
2 participants
@olivergierke

Writing Guava Predicates one usually ends up writing quite a few anonymous inner classes. This could be significantly improved by providing adapters of Querydsl predicates to Guava ones.

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Jun 12, 2012

Member

You hade something like this in mind?

@Test
public void Predicate() {
    Predicate<Cat> predicate = GuavaHelpers.wrap(QCat.cat.name.startsWith("Ann"));
    assertTrue(predicate.apply(new Cat("Ann")));
    assertFalse(predicate.apply(new Cat("Bob")));
}

@Test
public void Function() {
    Function<Cat, String> function = GuavaHelpers.wrap(QCat.cat.name);
    assertEquals("Ann", function.apply(new Cat("Ann")));
    assertEquals("Bob", function.apply(new Cat("Bob")));
}
Member

timowest commented Jun 12, 2012

You hade something like this in mind?

@Test
public void Predicate() {
    Predicate<Cat> predicate = GuavaHelpers.wrap(QCat.cat.name.startsWith("Ann"));
    assertTrue(predicate.apply(new Cat("Ann")));
    assertFalse(predicate.apply(new Cat("Bob")));
}

@Test
public void Function() {
    Function<Cat, String> function = GuavaHelpers.wrap(QCat.cat.name);
    assertEquals("Ann", function.apply(new Cat("Ann")));
    assertEquals("Bob", function.apply(new Cat("Bob")));
}
@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Jun 28, 2012

Member

Released in 2.7.0

Member

timowest commented Jun 28, 2012

Released in 2.7.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment