ConvertGroup class

An annotation next to @Valid() that checks the nested value with another group: when the outer validation runs group from, the nested value is checked with group to.

Use it when a nested object's rules depend on its owner's situation, for example a car's driver whose licence only matters for the car's checks. Without @Valid() it is a declaration error. Jakarta's @ConvertGroup.

// The ordinary check of a Car checks its driver's DriverChecks rules.
abstract final class DriverChecks {}

@Introspected()
class Car {
  @Valid()
  @ConvertGroup(to: DriverChecks) // from: Default
  Driver? driver;
}

Spring (Java):

@Valid
@ConvertGroup(from = Default.class, to = DriverChecks.class)
private Driver driver;

Constructors

ConvertGroup({required Type to, Type from = Default})
Turns the group from (by default Default) into to for the nested value; one conversion per from group.
const

Properties

from → Type
The group of the outer validation that is converted.
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
to → Type
The group the nested value is checked with instead.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited