Example usage for org.apache.commons.lang3.tuple MutableTriple setLeft

List of usage examples for org.apache.commons.lang3.tuple MutableTriple setLeft

Introduction

In this page you can find the example usage for org.apache.commons.lang3.tuple MutableTriple setLeft.

Prototype

public void setLeft(final L left) 

Source Link

Document

Sets the left element of the triple.

Usage

From source file:be.shad.tsqb.test.SelectTests.java

@Test
public void selectNestedComponentTypeValues() {
    Product product = query.from(Product.class);

    @SuppressWarnings("unchecked")
    MutableTriple<String, String, Boolean> triple = query.select(MutableTriple.class);
    triple.setLeft(product.getName());
    triple.setMiddle(product.getProductProperties().getPlanning().getAlgorithm());
    triple.setRight(product.getProductProperties().getSales().isSalesAllowed());

    validate(// w  w w . jav a  2s. c o  m
            "select hobj1.name as left, hobj1.productProperties.planning.algorithm as middle, hobj1.productProperties.sales.salesAllowed as right from Product hobj1");
}

From source file:be.shad.tsqb.test.SelectTests.java

@Test
public void selectMultiJoinedEntityValues() {
    Person person = query.from(Person.class);
    PersonProperty property1 = query.join(person.getProperties());
    PersonProperty property2 = query.join(person.getProperties(), JoinType.Inner, true);

    query.joinWith(property1).where(property1.getPropertyKey()).eq("FavoriteColor");
    query.joinWith(property2).where(property2.getPropertyKey()).eq("FavoriteDish");

    @SuppressWarnings("unchecked")
    MutableTriple<Long, String, Object> triple = query.select(MutableTriple.class);
    triple.setLeft(person.getId());
    triple.setMiddle(property1.getPropertyValue());
    triple.setRight(property2.getPropertyValue());

    validate(//from w  w  w.  j a v  a  2  s . c o  m
            "select hobj1.id as left, hobj2.propertyValue as middle, hobj3.propertyValue as right "
                    + "from Person hobj1 " + "join hobj1.properties hobj2 with hobj2.propertyKey = :np1 "
                    + "join hobj1.properties hobj3 with hobj3.propertyKey = :np2",
            "FavoriteColor", "FavoriteDish");
}