diff --git a/src/main/java/org/springframework/data/util/TypeDiscoverer.java b/src/main/java/org/springframework/data/util/TypeDiscoverer.java index e87f6ca4d..0ee9e0b2d 100644 --- a/src/main/java/org/springframework/data/util/TypeDiscoverer.java +++ b/src/main/java/org/springframework/data/util/TypeDiscoverer.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2012 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. @@ -177,7 +177,7 @@ class TypeDiscoverer implements TypeInformation { } String head = fieldname.substring(0, separatorIndex); - TypeInformation info = fieldTypes.get(head); + TypeInformation info = getProperty(head); return info == null ? null : info.getProperty(fieldname.substring(separatorIndex + 1)); } diff --git a/src/test/java/org/springframework/data/util/ClassTypeInformationUnitTests.java b/src/test/java/org/springframework/data/util/ClassTypeInformationUnitTests.java index 61232616e..032d66162 100644 --- a/src/test/java/org/springframework/data/util/ClassTypeInformationUnitTests.java +++ b/src/test/java/org/springframework/data/util/ClassTypeInformationUnitTests.java @@ -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 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 { } @@ -375,4 +389,13 @@ public class ClassTypeInformationUnitTests { class LongImplementation implements GenericInterface { } + + interface Product { + Category getCategory(); + } + + interface Category { + + Long getId(); + } }