@Test public void testImportRelationship() { String typeName = "org.example.model.TargetEntity"; ObjEntity entity = mock(ObjEntity.class); when(entity.getClassName()).thenReturn(typeName); when(entity.getName()).thenReturn("target"); ObjRelationship relationship = mock(ObjRelationship.class); when(relationship.isToMany()).thenReturn(true); when(relationship.getCollectionType()).thenReturn("java.util.List"); when(relationship.getTargetEntityName()).thenReturn("target"); when(relationship.getName()).thenReturn("list_rel"); when(relationship.getTargetEntity()).thenReturn(entity); Map<String, String> importTypesMap = importUtils.importTypesMap; assertEquals(0, importTypesMap.size()); propertyUtils.addImport(relationship); assertEquals(4, importTypesMap.size()); assertEquals(typeName, importTypesMap.get("TargetEntity")); assertEquals(List.class.getName(), importTypesMap.get("List")); assertEquals(ListProperty.class.getName(), importTypesMap.get("ListProperty")); assertEquals(PropertyFactory.class.getName(), importTypesMap.get("PropertyFactory")); }
public void addImport(ObjAttribute attribute) throws ClassNotFoundException { importUtils.addType(PropertyFactory.class.getName()); importUtils.addType(attribute.getType()); importUtils.addType(getPropertyDescriptor(attribute.getType()).getPropertyType()); if(attribute.isLazy()) { importUtils.addType(Fault.class.getName()); } }
PropertyUtils { public void addImport(ObjAttribute attribute) throws ClassNotFoundException { importUtils.addType(PropertyFactory.class.getName()); importUtils.addType(attribute.getType()); importUtils.addType(getPropertyDescriptor(attribute.getType()).getPropertyType()); if(attribute.isLazy()) { importUtils.addType(Fault.class.getName()); } } }
PropertyUtils { public void addImport(ObjAttribute attribute) throws ClassNotFoundException { importUtils.addType(PropertyFactory.class.getName()); importUtils.addType(attribute.getType()); importUtils.addType(getPropertyDescriptor(attribute.getType()).getPropertyType()); if(attribute.isLazy()) { importUtils.addType(Fault.class.getName()); } } PropertyUtils(ImportUtils importUtils);  PropertyUtils(ImportUtils importUtils,
                         AdhocObjectFactory adhocObjectFactory,
                         List<PropertyDescriptorCreator> propertyList,
                         Logger logger); }
PropertyUtils { public void addImport(ObjAttribute attribute) throws ClassNotFoundException { importUtils.addType(PropertyFactory.class.getName()); importUtils.addType(attribute.getType()); importUtils.addType(getPropertyDescriptor(attribute.getType()).getPropertyType()); if(attribute.isLazy()) { importUtils.addType(Fault.class.getName()); } } PropertyUtils(ImportUtils importUtils);  PropertyUtils(ImportUtils importUtils,
                         AdhocObjectFactory adhocObjectFactory,
                         List<PropertyDescriptorCreator> propertyList,
                         Logger logger); void addImportForPK(EntityUtils entityUtils); void addImport(ObjAttribute attribute); void addImport(EmbeddedAttribute attribute); void addImport(EmbeddableAttribute attribute); void addImport(ObjRelationship relationship); void addImport(ObjRelationship relationship, boolean client); String propertyDefinition(ObjEntity entity, DbAttribute attribute); String propertyDefinition(ObjAttribute attribute, boolean client); String propertyDefinition(ObjAttribute attribute); String propertyDefinition(EmbeddedAttribute attribute); String propertyDefinition(EmbeddableAttribute attribute); String propertyDefinition(ObjRelationship relationship, boolean client); String propertyDefinition(ObjRelationship relationship); PropertyDescriptor getPropertyDescriptor(String attrType); }
PropertyUtils { public void addImport(ObjAttribute attribute) throws ClassNotFoundException { importUtils.addType(PropertyFactory.class.getName()); importUtils.addType(attribute.getType()); importUtils.addType(getPropertyDescriptor(attribute.getType()).getPropertyType()); if(attribute.isLazy()) { importUtils.addType(Fault.class.getName()); } } PropertyUtils(ImportUtils importUtils);  PropertyUtils(ImportUtils importUtils,
                         AdhocObjectFactory adhocObjectFactory,
                         List<PropertyDescriptorCreator> propertyList,
                         Logger logger); void addImportForPK(EntityUtils entityUtils); void addImport(ObjAttribute attribute); void addImport(EmbeddedAttribute attribute); void addImport(EmbeddableAttribute attribute); void addImport(ObjRelationship relationship); void addImport(ObjRelationship relationship, boolean client); String propertyDefinition(ObjEntity entity, DbAttribute attribute); String propertyDefinition(ObjAttribute attribute, boolean client); String propertyDefinition(ObjAttribute attribute); String propertyDefinition(EmbeddedAttribute attribute); String propertyDefinition(EmbeddableAttribute attribute); String propertyDefinition(ObjRelationship relationship, boolean client); String propertyDefinition(ObjRelationship relationship); PropertyDescriptor getPropertyDescriptor(String attrType);  }