We need to create an annotation in java called DateFormat. It will take string dateformat eg.
class User
{
@Dateformat("MMM/dd/yyyy")
private Date birthDate;
}
Here the date format is statically passed as an argument to the annotation. Is there any way we can pass this date format at run time may be from session.
Please help.
Directly, no.
But if you have a property-resolution mechanism, you can have something like:
And resolve the
birth.date.formatproperty when parsing the annotation.