@Test public void testGetConditionAttributeModel() throws Exception { PropertyMeta propertyMeta = new PropertyMeta(); propertyMeta.setName("property"); propertyMeta.setField(getClass().getDeclaredField("property")); ConditionAttributeModel model = factory .getConditionAttributeModel(propertyMeta); assertEquals("property", model.getName()); assertEquals(String.class, model.getAttributeClass()); assertEquals(NullableStringCondition.class, model.getConditionClass()); assertFalse(model.isParameterized()); }
public ConditionAttributeModel getConditionAttributeModel( PropertyMeta propertyMeta) { ConditionAttributeModel attributeModel = new ConditionAttributeModel(); attributeModel.setName(propertyMeta.getName()); Class<?> clazz = ClassUtil.getWrapperClassIfPrimitive(propertyMeta .getPropertyClass()); attributeModel.setAttributeClass(clazz); Field field = propertyMeta.getField(); Column column = field.getAnnotation(Column.class); if (column == null) { column = AnnotationUtil.getDefaultColumn(); } Class<?> conditionClass = null; if (clazz == String.class) { conditionClass = column.nullable() ? NullableStringCondition.class : NotNullableStringCondition.class; } else { conditionClass = column.nullable() ? NullableCondition.class : NotNullableCondition.class; attributeModel.setParameterized(true); } attributeModel.setConditionClass(conditionClass); return attributeModel; }
ConditionAttributeModelFactoryImpl implements
        ConditionAttributeModelFactory { public ConditionAttributeModel getConditionAttributeModel( PropertyMeta propertyMeta) { ConditionAttributeModel attributeModel = new ConditionAttributeModel(); attributeModel.setName(propertyMeta.getName()); Class<?> clazz = ClassUtil.getWrapperClassIfPrimitive(propertyMeta .getPropertyClass()); attributeModel.setAttributeClass(clazz); Field field = propertyMeta.getField(); Column column = field.getAnnotation(Column.class); if (column == null) { column = AnnotationUtil.getDefaultColumn(); } Class<?> conditionClass = null; if (clazz == String.class) { conditionClass = column.nullable() ? NullableStringCondition.class : NotNullableStringCondition.class; } else { conditionClass = column.nullable() ? NullableCondition.class : NotNullableCondition.class; attributeModel.setParameterized(true); } attributeModel.setConditionClass(conditionClass); return attributeModel; } }
ConditionAttributeModelFactoryImpl implements
        ConditionAttributeModelFactory { public ConditionAttributeModel getConditionAttributeModel( PropertyMeta propertyMeta) { ConditionAttributeModel attributeModel = new ConditionAttributeModel(); attributeModel.setName(propertyMeta.getName()); Class<?> clazz = ClassUtil.getWrapperClassIfPrimitive(propertyMeta .getPropertyClass()); attributeModel.setAttributeClass(clazz); Field field = propertyMeta.getField(); Column column = field.getAnnotation(Column.class); if (column == null) { column = AnnotationUtil.getDefaultColumn(); } Class<?> conditionClass = null; if (clazz == String.class) { conditionClass = column.nullable() ? NullableStringCondition.class : NotNullableStringCondition.class; } else { conditionClass = column.nullable() ? NullableCondition.class : NotNullableCondition.class; attributeModel.setParameterized(true); } attributeModel.setConditionClass(conditionClass); return attributeModel; }  }
ConditionAttributeModelFactoryImpl implements
        ConditionAttributeModelFactory { public ConditionAttributeModel getConditionAttributeModel( PropertyMeta propertyMeta) { ConditionAttributeModel attributeModel = new ConditionAttributeModel(); attributeModel.setName(propertyMeta.getName()); Class<?> clazz = ClassUtil.getWrapperClassIfPrimitive(propertyMeta .getPropertyClass()); attributeModel.setAttributeClass(clazz); Field field = propertyMeta.getField(); Column column = field.getAnnotation(Column.class); if (column == null) { column = AnnotationUtil.getDefaultColumn(); } Class<?> conditionClass = null; if (clazz == String.class) { conditionClass = column.nullable() ? NullableStringCondition.class : NotNullableStringCondition.class; } else { conditionClass = column.nullable() ? NullableCondition.class : NotNullableCondition.class; attributeModel.setParameterized(true); } attributeModel.setConditionClass(conditionClass); return attributeModel; }  ConditionAttributeModel getConditionAttributeModel(
            PropertyMeta propertyMeta); }
ConditionAttributeModelFactoryImpl implements
        ConditionAttributeModelFactory { public ConditionAttributeModel getConditionAttributeModel( PropertyMeta propertyMeta) { ConditionAttributeModel attributeModel = new ConditionAttributeModel(); attributeModel.setName(propertyMeta.getName()); Class<?> clazz = ClassUtil.getWrapperClassIfPrimitive(propertyMeta .getPropertyClass()); attributeModel.setAttributeClass(clazz); Field field = propertyMeta.getField(); Column column = field.getAnnotation(Column.class); if (column == null) { column = AnnotationUtil.getDefaultColumn(); } Class<?> conditionClass = null; if (clazz == String.class) { conditionClass = column.nullable() ? NullableStringCondition.class : NotNullableStringCondition.class; } else { conditionClass = column.nullable() ? NullableCondition.class : NotNullableCondition.class; attributeModel.setParameterized(true); } attributeModel.setConditionClass(conditionClass); return attributeModel; }  ConditionAttributeModel getConditionAttributeModel(
            PropertyMeta propertyMeta);  }