LazyEntityModelWrapper implements EntityModel<T> { @Override public List<String> getAttributeGroups() { return getDelegate().getAttributeGroups(); } LazyEntityModelWrapper(EntityModelFactory factory, String reference, Class<T> entityClass); @Override void addAttributeModel(String attributeGroup, AttributeModel model, AttributeModel existingModel); @Override List<String> getAttributeGroups(); @Override AttributeModel getAttributeModel(String attributeName); @Override List<AttributeModel> getAttributeModels(); @Override List<AttributeModel> getAttributeModelsForGroup(String group); @Override List<AttributeModel> getAttributeModelsForType(AttributeType attributeType, Class<?> type); @Override List<AttributeModel> getCascadeAttributeModels(); @Override String getDescription(Locale locale); @Override String getDisplayProperty(); @Override Class<T> getEntityClass(); @Override AttributeModel getIdAttributeModel(); @Override AttributeModel getMainAttributeModel(); @Override String getReference(); @Override List<AttributeModel> getRequiredForSearchingAttributeModels(); @Override Map<AttributeModel, Boolean> getSortOrder(); @Override boolean isAttributeGroupVisible(String group, boolean readOnly); @Override boolean usesDefaultGroupOnly(); @Override void addAttributeGroup(String attributeGroup); @Override String getDisplayName(Locale locale); @Override String getDisplayNamePlural(Locale locale);  }
@Test public void test() { LazyEntityModelWrapper<TestEntity> wrapper = new LazyEntityModelWrapper<>(factory, "TestEntity", TestEntity.class); assertFalse(factory.hasModel("TestEntity")); wrapper.getAttributeGroups(); assertTrue(factory.hasModel("TestEntity")); }