|
|
|
|
|
|
Currently the constraint type needs to be specified twice when using {{GenericConstraintDef}}:
{code} new GenericConstraintDef<MyConstraint>( MyConstraint.class ) .param( "myParam", 2 ); {code}
This could be avoided e.g. by providing a static factory method which leverages type inference:
{code} GenericConstraintDef.getInstance( MyConstraint.class ) .param( "myParam", 2 ); {code}
Or we provide a parameterless constructor used by anonymous subclasses and retrieve the value of the type parameter internally:
{code} new GenericConstraintDef< LuggageCountMatchesPassengerCount MyConstraint >(){} .param( "myParam", 2 ); {code}
The latter would break compatability though if we want to enforce subclassing by making {{GenericConstraintDef}} an anonymous class.
|
|
|
|
|
|