Package com.mysema.query.types.path

Examples of com.mysema.query.types.path.StringPath


    enum ExampleEnum {A,B}

    @Test
    public void As_usage() {
        SimpleExpression<String> str = new StringPath("str");
        assertEquals("str as alias", str.as("alias").toString());
        assertEquals("str as alias", str.as(new StringPath("alias")).toString());
    }
View Full Code Here


        assertEquals("str as alias", str.as(new StringPath("alias")).toString());
    }
   
    @Test
    public void Case() {
        SimpleExpression<String> str = new StringPath("str");
        // nullif(str, 'xxx')
        str.when("xxx").thenNull().otherwise(str);
    }
View Full Code Here

        paths.add(new ListPath(String.class, StringPath.class, "p"));
        paths.add(new MapPath(String.class, String.class, StringPath.class, "p"));
        paths.add(new NumberPath(Integer.class,"p"));
        paths.add(new SetPath(String.class, StringPath.class, "p"));
        paths.add(new SimplePath(String.class,"p"));
        paths.add(new StringPath("p"));
        paths.add(new TimePath(Time.class,"p"));

        for (DslExpression<?> expr : paths) {
            Path o = new PathImpl(expr.getType(), "o");
            assertEquals(OperationImpl.create(expr.getType(), Ops.ALIAS, expr, o), expr.as("o"));
View Full Code Here

public class TemplateTest {

    @Test
    public void ToDate() {
        StringExpression str = new StringPath("str");
        assertEquals("to_date(str,'DD-MON-YYYY')", to_date(str, "DD-MON-YYYY").toString());
    }
View Full Code Here

  }

  @Test
  public void uses_idAsKeyForIdProperty() {

    StringPath path = QPerson.person.id;
    assertThat(serializer.getKeyForPath(path, path.getMetadata()), is("_id"));
  }
View Full Code Here

    assertThat(serializer.getKeyForPath(path, path.getMetadata()), is("_id"));
  }

  @Test
  public void buildsNestedKeyCorrectly() {
    StringPath path = QPerson.person.address.street;
    assertThat(serializer.getKeyForPath(path, path.getMetadata()), is("street"));
  }
View Full Code Here

  public void convertsIdPropertyCorrectly() {

    ObjectId id = new ObjectId();

    PathBuilder<Address> builder = new PathBuilder<Address>(Address.class, "address");
    StringPath idPath = builder.getString("id");

    DBObject result = (DBObject) serializer.visit((BooleanOperation) idPath.eq(id.toString()), (Void) null);
    assertThat(result.get("_id"), is(notNullValue()));
    assertThat(result.get("_id"), is(instanceOf(ObjectId.class)));
    assertThat(result.get("_id"), is((Object) id));
  }
View Full Code Here

TOP

Related Classes of com.mysema.query.types.path.StringPath

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.