DATACMNS-77 - Introduced caching inside ClassTypeInformation.

ClassTypeInformation now holds a cache for Class<?> to TypeInformation<?> mappings. It also exposes constants for Object, Collection, Set, List and Map TypeInformations.
This commit is contained in:
Oliver Gierke
2011-12-02 11:29:11 +01:00
parent a4ac30d52b
commit a5a925e37a
2 changed files with 46 additions and 4 deletions

View File

@@ -148,6 +148,16 @@ public class ClassTypeInformationUnitTests {
assertThat(property.getType(), is(typeCompatibleWith(byte[].class)));
}
/**
* @see DATACMNS-77
*/
@Test
public void returnsSameInstanceForCachedClass() {
TypeInformation<PropertyGetter> info = ClassTypeInformation.from(PropertyGetter.class);
assertThat(ClassTypeInformation.from(PropertyGetter.class), is(sameInstance(info)));
}
static class StringMapContainer extends MapContainer<String> {
}