DATACMNS-309 - Fixed lookup of nested properties on TypeDiscoverer.

So far the property lookup of a nested property path (e.g. "foo.bar") failed in cases the head property was not cached already. We now recursively resolve the type information even for an unpopulated cache.
This commit is contained in:
Oliver Gierke
2013-04-05 20:42:31 +02:00
parent 64dada5896
commit a7820c8cc6
2 changed files with 26 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011 the original author or authors.
* Copyright 2011-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -263,6 +263,20 @@ public class ClassTypeInformationUnitTests {
assertThat(information.getActualType().getActualType().getType(), is((Object) String.class));
}
/**
* @see DATACMNS-309
*/
@Test
@SuppressWarnings("rawtypes")
public void findsGetterOnInterface() {
TypeInformation<Product> information = from(Product.class);
TypeInformation<?> categoryIdInfo = information.getProperty("category.id");
assertThat(categoryIdInfo, is(notNullValue()));
assertThat(categoryIdInfo, is((TypeInformation) from(Long.class)));
}
static class StringMapContainer extends MapContainer<String> {
}
@@ -375,4 +389,13 @@ public class ClassTypeInformationUnitTests {
class LongImplementation implements GenericInterface<Long> {
}
interface Product {
Category getCategory();
}
interface Category {
Long getId();
}
}