Class DefaultValidator

java.lang.Object
io.fluxzero.sdk.tracking.handling.validation.jakarta.DefaultJakartaValidator
io.fluxzero.sdk.tracking.handling.validation.DefaultValidator
All Implemented Interfaces:
Validator

public class DefaultValidator extends DefaultJakartaValidator
Canonical SDK entry point for Fluxzero's Validation implementation.

This validator supports the Jakarta Validation annotations and features used by the SDK, including built-in constraints, custom constraints, groups, cascaded validation, type-use/container validation, executable parameter and return-value validation, metadata lookup, value extractors, and Fluxzero-clock based temporal checks.

Normal payload validation (assertValid, checkValidity, isValid) checks fields and their cascades before the containing object's constrained methods. Pure methods need not repeat null guards for values required by active field/container constraints. Optional values and inactive groups do not establish that precondition. A diagnostic pass may still invoke methods after field failures, retaining field violations if that pass throws. Raw getConstraintViolations and Jakarta validate do not suppress such method exceptions. This ordering is specific to this implementation, not a requirement on replacement validators.

It is intentionally not a full standalone Jakarta Validation provider replacement for every TCK edge case: XML mappings, validation.xml, CDI lifecycle integration, TraversableResolver reachability rules, and full Expression Language message evaluation are outside the supported SDK profile.

  • Field Details

    • BEAN_PROPERTY_METHOD_NAMES_ONLY_PROPERTY

      public static final String BEAN_PROPERTY_METHOD_NAMES_ONLY_PROPERTY
      Application property that switches bean validation for no-argument methods to JavaBean/Hibernate-compatible getter naming only. When set to true, only annotated getX(), isX(), and hasX() methods are treated as bean properties. The default is false, so any annotated no-argument method with a return value is validated. The setting is read when the validator is constructed.
      See Also:
  • Constructor Details

    • DefaultValidator

      public DefaultValidator()
      Creates a validator that uses the current Fluxzero clock for temporal constraints.
    • DefaultValidator

      public DefaultValidator(Clock clock)
      Creates a validator that uses the supplied clock for temporal constraints such as @Past and @Future.
      Parameters:
      clock - the clock to use while validating temporal constraints
    • DefaultValidator

      protected DefaultValidator(jakarta.validation.ClockProvider clockProvider)
      Creates a validator that obtains its clock from the supplied Jakarta ClockProvider.
      Parameters:
      clockProvider - provider used for temporal constraints
  • Method Details

    • createDefault

      public static DefaultValidator createDefault()
      Creates the default SDK validator instance.
      Returns:
      a validator backed by the current Fluxzero clock