public <T> T getObject(final Class<T> clazz) {
Assert.notNull(clazz, "clazz");
if (this.context == null) {
throw new DomainException("Context not initialized");
}
Map<String, T> map = this.context.getBeansOfType(clazz);
if (map.size() == 0) {
throw new DomainException("Object not found for type " + clazz.getCanonicalName());
}
if (map.size() > 1) {
throw new DomainException("To many objects found for type " + clazz.getCanonicalName());
}
return map.values().iterator().next();
}