@Test public void testGetConditionModel() throws Exception { EntityMeta entityMeta = entityMetaFactory.getEntityMeta(Aaa.class); ConditionModel model = conditionModelfactory .getConditionModel(entityMeta); assertEquals("aaa.bbb", model.getPackageName()); assertEquals("ConditionModelFactoryImplTest$AaaCondition", model .getShortClassName()); assertEquals(6, model.getConditionAttributeModelList().size()); assertEquals(1, model.getConditionAssociationModelList().size()); Set<String> set = model.getImportNameSet(); assertEquals(8, set.size()); Iterator<String> iterator = set.iterator(); assertEquals(Date.class.getCanonicalName(), iterator.next()); assertEquals(Generated.class.getCanonicalName(), iterator.next()); assertEquals(ComplexWhere.class.getCanonicalName(), iterator.next()); assertEquals(AbstractEntityCondition.class.getCanonicalName(), iterator .next()); assertEquals(NotNullableCondition.class.getCanonicalName(), iterator .next()); assertEquals(NotNullableStringCondition.class.getCanonicalName(), iterator.next()); assertEquals(NullableCondition.class.getCanonicalName(), iterator .next()); assertEquals(NullableStringCondition.class.getCanonicalName(), iterator .next()); }
public ConditionModel getConditionModel(EntityMeta entityMeta) { ConditionModel conditionModel = new ConditionModel(); conditionModel.setPackageName(packageName); conditionModel.setShortClassName(entityMeta.getName() + conditionClassNameSuffix); conditionModel.setShortEntityClassName(entityMeta.getEntityClass() .getSimpleName()); for (int i = 0; i < entityMeta.getPropertyMetaSize(); i++) { PropertyMeta propertyMeta = entityMeta.getPropertyMeta(i); if (propertyMeta.isTransient()) { continue; } if (propertyMeta.isRelationship()) { doConditionMethodModel(conditionModel, propertyMeta); } else { doConditionAttributeModel(conditionModel, propertyMeta); } } doImportName(conditionModel, entityMeta); doGeneratedInfo(conditionModel, entityMeta); return conditionModel; }
ConditionModelFactoryImpl implements ConditionModelFactory { public ConditionModel getConditionModel(EntityMeta entityMeta) { ConditionModel conditionModel = new ConditionModel(); conditionModel.setPackageName(packageName); conditionModel.setShortClassName(entityMeta.getName() + conditionClassNameSuffix); conditionModel.setShortEntityClassName(entityMeta.getEntityClass() .getSimpleName()); for (int i = 0; i < entityMeta.getPropertyMetaSize(); i++) { PropertyMeta propertyMeta = entityMeta.getPropertyMeta(i); if (propertyMeta.isTransient()) { continue; } if (propertyMeta.isRelationship()) { doConditionMethodModel(conditionModel, propertyMeta); } else { doConditionAttributeModel(conditionModel, propertyMeta); } } doImportName(conditionModel, entityMeta); doGeneratedInfo(conditionModel, entityMeta); return conditionModel; } }
ConditionModelFactoryImpl implements ConditionModelFactory { public ConditionModel getConditionModel(EntityMeta entityMeta) { ConditionModel conditionModel = new ConditionModel(); conditionModel.setPackageName(packageName); conditionModel.setShortClassName(entityMeta.getName() + conditionClassNameSuffix); conditionModel.setShortEntityClassName(entityMeta.getEntityClass() .getSimpleName()); for (int i = 0; i < entityMeta.getPropertyMetaSize(); i++) { PropertyMeta propertyMeta = entityMeta.getPropertyMeta(i); if (propertyMeta.isTransient()) { continue; } if (propertyMeta.isRelationship()) { doConditionMethodModel(conditionModel, propertyMeta); } else { doConditionAttributeModel(conditionModel, propertyMeta); } } doImportName(conditionModel, entityMeta); doGeneratedInfo(conditionModel, entityMeta); return conditionModel; } ConditionModelFactoryImpl(
            ConditionAttributeModelFactory conditionAttributeModelFactory,
            ConditionAssociationModelFactory conditionAssociationModelFactory,
            String packageName, String conditionClassNameSuffix); }
ConditionModelFactoryImpl implements ConditionModelFactory { public ConditionModel getConditionModel(EntityMeta entityMeta) { ConditionModel conditionModel = new ConditionModel(); conditionModel.setPackageName(packageName); conditionModel.setShortClassName(entityMeta.getName() + conditionClassNameSuffix); conditionModel.setShortEntityClassName(entityMeta.getEntityClass() .getSimpleName()); for (int i = 0; i < entityMeta.getPropertyMetaSize(); i++) { PropertyMeta propertyMeta = entityMeta.getPropertyMeta(i); if (propertyMeta.isTransient()) { continue; } if (propertyMeta.isRelationship()) { doConditionMethodModel(conditionModel, propertyMeta); } else { doConditionAttributeModel(conditionModel, propertyMeta); } } doImportName(conditionModel, entityMeta); doGeneratedInfo(conditionModel, entityMeta); return conditionModel; } ConditionModelFactoryImpl(
            ConditionAttributeModelFactory conditionAttributeModelFactory,
            ConditionAssociationModelFactory conditionAssociationModelFactory,
            String packageName, String conditionClassNameSuffix); ConditionModel getConditionModel(EntityMeta entityMeta); }
ConditionModelFactoryImpl implements ConditionModelFactory { public ConditionModel getConditionModel(EntityMeta entityMeta) { ConditionModel conditionModel = new ConditionModel(); conditionModel.setPackageName(packageName); conditionModel.setShortClassName(entityMeta.getName() + conditionClassNameSuffix); conditionModel.setShortEntityClassName(entityMeta.getEntityClass() .getSimpleName()); for (int i = 0; i < entityMeta.getPropertyMetaSize(); i++) { PropertyMeta propertyMeta = entityMeta.getPropertyMeta(i); if (propertyMeta.isTransient()) { continue; } if (propertyMeta.isRelationship()) { doConditionMethodModel(conditionModel, propertyMeta); } else { doConditionAttributeModel(conditionModel, propertyMeta); } } doImportName(conditionModel, entityMeta); doGeneratedInfo(conditionModel, entityMeta); return conditionModel; } ConditionModelFactoryImpl(
            ConditionAttributeModelFactory conditionAttributeModelFactory,
            ConditionAssociationModelFactory conditionAssociationModelFactory,
            String packageName, String conditionClassNameSuffix); ConditionModel getConditionModel(EntityMeta entityMeta);  }