This commit is contained in:
Timo Westkämper 2010-09-08 19:40:06 +00:00
parent e4545f537a
commit 7abbee27e5
2 changed files with 18 additions and 0 deletions

View File

@ -6,6 +6,7 @@
package com.mysema.query.scala;
import com.mysema.query.alias.Alias._
import com.mysema.query.types.expr._
import com.mysema.query.types.path._
/**
@ -14,6 +15,8 @@ import com.mysema.query.types.path._
*/
object Conversions {
def not(b: EBoolean): EBoolean = b.not()
implicit def _boolean(b: Boolean): PBoolean = $(b);
implicit def _string(s: String): PString = $(s);

View File

@ -32,6 +32,21 @@ class AliasTest {
assertEquals("domainType.firstName like Hello", (domainType.firstName like "Hello").toString());
assertEquals("domainType.firstName ASC", (domainType.firstName asc).toString());
// and
var andClause = (domainType.firstName like "An%") and (domainType.firstName like "Be%");
assertEquals("domainType.firstName like An% && domainType.firstName like Be%", andClause.toString);
// or
var orClause = (domainType.firstName like "An%") or (domainType.firstName like "Be%");
assertEquals("domainType.firstName like An% || domainType.firstName like Be%", orClause.toString);
// not
var notClause = (domainType.firstName like "An%") not;
assertEquals("!domainType.firstName like An%", notClause.toString);
notClause = not (domainType.firstName like "An%");
assertEquals("!domainType.firstName like An%", notClause.toString);
// FIXME : "eq" and "ne" are already reserved
// assertEquals("domainType.firstName = Hello", (domainType.firstName eq "Hello").toString());
// assertEquals("domainType.firstName != Hello", (domainType.firstName ne "Hello").toString());