Example usage for org.springframework.data.domain Example of

List of usage examples for org.springframework.data.domain Example of

Introduction

In this page you can find the example usage for org.springframework.data.domain Example of.

Prototype

static <T> Example<T> of(T probe, ExampleMatcher matcher) 

Source Link

Document

Create a new Example using the given ExampleMatcher .

Usage

From source file:example.springdata.mongodb.querybyexample.MongoOperationsIntegrationTests.java

/**
 * @see #153//ww  w  .  j av a2 s.c  o  m
 */
@Test
public void valueTransformer() {

    Example<Person> example = Example.of(new Person(null, "White", 99), matching(). //
            withMatcher("age", matcher -> matcher.transform(value -> Integer.valueOf(50))));

    assertThat(operations.find(query(byExample(example)), Person.class), hasItems(walter));
}

From source file:org.egov.restapi.web.contracts.tradelicense.TradeLicenseDetailRequest.java

public Example tradeLicenseLike() {
    TradeLicense license = new TradeLicense();
    if (isNotBlank(tin))
        license.setLicenseNumber(tin);// www .  ja  va 2 s . co m
    Boundary ward = new Boundary();
    ward.setBoundaryNum(wardNo);
    ward.setActive(true);
    license.setParentBoundary(ward);
    license.setIsActive(true);
    ExampleMatcher matcher = ExampleMatcher.matching().withIgnorePaths("legacy", "newWorkflow",
            "collectionPending");
    return Example.of(license, matcher);
}