use of org.dbflute.s2dao.metadata.TnModifiedPropertySupport in project dbflute-core by dbflute.
the class TnBeanMetaDataFactoryExtension method createModifiedPropertySupport.
// ===================================================================================
// Override for ModifiedProperty
// =============================
@Override
protected TnModifiedPropertySupport createModifiedPropertySupport() {
return new TnModifiedPropertySupport() {
public Set<String> getModifiedPropertyNames(Object bean) {
if (bean instanceof Entity) {
// all entities of DBFlute are here
return ((Entity) bean).mymodifiedProperties();
} else {
// basically no way on DBFlute (S2Dao's route)
final DfBeanDesc beanDesc = DfBeanDescFactory.getBeanDesc(bean.getClass());
final String propertyName = MODIFIED_PROPERTY_PROPERTY_NAME;
if (!beanDesc.hasPropertyDesc(propertyName)) {
return DfCollectionUtil.emptySet();
} else {
final DfPropertyDesc propertyDesc = beanDesc.getPropertyDesc(propertyName);
final Object value = propertyDesc.getValue(bean);
if (value != null) {
@SuppressWarnings("unchecked") final Set<String> extractedSet = (Set<String>) value;
return extractedSet;
} else {
return DfCollectionUtil.emptySet();
}
}
}
}
};
}
Aggregations