我想使用Lombook框架并扩展我映射的Java类。目前,我使用这个:
// @Mapper(config = BaseMapperConfig.class)
public interface MerchantsMapper {
MerchantNewDTO toNewDTO(Merchants merchant);
}
自定义实现:
public MerchantNewDTO toNewDTO(Merchants merchant)
{
MerchantNewDTO merchantNewDTO = new MerchantNewDTO();
merchantNewDTO.setId(Integer.valueOf(merchant.getId()));
......
MerchantConfigurationUtils merchant_config = new MerchantConfigurationUtils();
Map<MerchantConfigurationFeatureBitString, Boolean> features = merchant_config.initFromDatabaseValue(merchant.getSupported_features());
merchantNewDTO.setSupports_api(features.get(MerchantConfigurationFeatureBitString.Supports_api));
return merchantNewDTO;
}
如您所见,我想获取getSupported_features
并填充Supports_api
值。
但是添加新值是非常痛苦的过程。有什么方法可以创建扩展映射接口并设置/获取值的适配器?