class TitleServiceDefault implements TitleService {

    @Override
    public String titleOf(final Object domainObject) {
        
        if(specificationLoader == null) { // simplified JUnit test support
            return "" + domainObject;
        }
        
        val pojo = unwrapped(domainObject);
        val objectAdapter = ManagedObject.of(specificationLoader::loadSpecification, pojo);
        if(EntityUtil.isDestroyed(objectAdapter)) {
            return "[DELETED]";
        } else {
            return objectAdapter.getSpecification().getTitle(null, objectAdapter);
        }
    }

    @Inject public  TitleServiceDefault(WrapperFactory wrapperFactory, SpecificationLoader specificationLoader);

}