podam icon indicating copy to clipboard operation
podam copied to clipboard

Strategy for custom date

Open dbclkclk opened this issue 11 years ago • 2 comments

Regarding the strategy method to override for custom date, when instantiate an object's property of type date. Looking at AbstractRandomDataProviderStrategy, I'm not sure which method i should override regarding custom dates.

dbclkclk avatar Oct 10 '15 02:10 dbclkclk

Hi Dean for non primitives and Object Podam will use introspection to create an object, using either the default or fullest constructor depending on what method you invoked to manufacture your object. To set custom dates, provided they result in the same Date type, you can use the attributemetadata object, intercept the field name you want to customise and return your special value. The tests have examples on how to use attributemetadata to customise values.

Hope this helps.

Regards,

On Sat, 10 Oct 2015 at 03:53, Dean [email protected] wrote:

Regarding the strategy method to override for custom date, when instantiate an object's property of type date. Looking at AbstractRandomDataProviderStrategy, I'm not sure which method i should override regarding custom dates.

— Reply to this email directly or view it on GitHub https://github.com/mtedone/podam/issues/126.

mtedone avatar Oct 10 '15 16:10 mtedone

Hi for non primitives and Object Podam will use introspection to create an object, using either the default or fullest constructor depending on what method you invoked to manufacture your object. To set custom dates, provided they result in the same Date type, you can use the attributemetadata object, intercept the field name you want to customise and return your special value. The tests have examples on how to use attributemetadata to customise values.

fani1983 avatar Nov 03 '15 05:11 fani1983