This commit is contained in:
Timo Westkämper 2011-02-28 13:47:35 +00:00
parent f6a1479f58
commit 2882621346
2 changed files with 17 additions and 0 deletions

View File

@ -103,6 +103,10 @@ trait ListExpression[T, Q <: Expression[_ >: T]] extends CollectionExpressionBas
def get(i: Int): Q;
def get(i: Expression[Integer]): Q;
def apply(i: Int) = get(i);
def apply(i: Expression[Integer]) = get(i);
}
@ -126,6 +130,9 @@ trait MapExpression[K, V, Q <: Expression[_ >: V]] extends SimpleExpression[java
def get(key: Expression[K]): Q;
def apply(key: K) = get(key);
def apply(key: Expression[K]) = get(key);
}

View File

@ -175,11 +175,21 @@ class ExpressionTest {
assertEquals("person.javaList.get(0) is not null", person.javaList.get(0) isNotNull);
assertEquals("person.javaMap.get(xxx) is null", person.javaMap.get("xxx") isNull);
}
@Test
def Java_Collection_Get_With_Apply {
assertEquals("person.javaList.get(0) is not null", person.javaList(0) isNotNull);
}
@Test
def Java_Collections_Get_And_Starts_With {
assertEquals("startsWith(person.javaMap.get(xxx),X)", person.javaMap.get("xxx") startsWith "X");
}
@Test
def Java_Collections_Get_With_Apply {
assertEquals("startsWith(person.javaMap.get(xxx),X)", person.javaMap("xxx") startsWith "X");
}
@Test
def Scala_Collections_Size {