tg icon indicating copy to clipboard operation
tg copied to clipboard

Modernisation of LeProperty and GeProperty setter annotations

Open 01es opened this issue 2 years ago • 0 comments

Description

The only remaining legacy validation annotations, used in application to setters, are LeProperty and GeProperty. All current use of these annotations are in application to date properties, representing from/to date ranges. These annotations are currently applicable only to methods, but should become applicable to fields as well. It is not desired to deprecate them because the standard way of declaring validators is more verbose:

@LeProperty("endPeriod")
Date startPeriod;
@BeforeChange(@Handler(LePropertyValidator.class, str = @StrParam(name = "prop", value = "periodEnd")))
Date startPeriod;
  • [x] 1. Develop validator LePropertyValidator to be used as a standard BCE handler instead of LeProperty. The actual implementation could reuse RangePropertyValidator. Currently, the validator for @LeProperty is instantiated in AbstractMetaPropertyFactory as new RangePropertyValidator(upperBoundaryProperties, false, dates).

  • [x] 2. Develop validator GePropertyValidator to be used as a standard BCE handler instead of GeProperty. The actual implementation could reuse RangePropertyValidator. Currently, the validator for @GeProperty is instantiated in AbstractMetaPropertyFactory as new RangePropertyValidator(lowerBoundaryProperties, true, dates).

  • [x] 3. Make @LeProperty and @GeProperty applicable to fields and replace instantiation of corresponding validators in AbstractMetaPropertyFactory to use LePropertyValidator and GePropertyValidator respectively.

  • [x] 4. Update code template tgprop-from-and-to for IntelliJ IDEA.

Expected outcome

Removal of the legacy setter-based approach to express constraints, achieving consistency in the way constraints are declared in domain models.

01es avatar Apr 09 '23 03:04 01es