java.lang.Object
org.ntnu.idi.idatt2106.sparesti.sparestibackend.validation.ObjectValidator<T>
Type Parameters:
T - The DTO type that class is validating
Direct Known Subclasses:
ChallengeConfigValidator, ChallengeValidator, GoalValidator, UserValidator

@Component @Primary public class ObjectValidator<T> extends Object
Validator class for DTO objects received from HTTP-requests Its generic type allows flexibility across DTO's
Since:
24.4.24
Version:
1.0
Author:
Harry L.X
  • Field Details

    • validator

      protected final jakarta.validation.Validator validator
      Validator object used for validation
  • Constructor Details

    • ObjectValidator

      public ObjectValidator()
  • Method Details

    • validate

      public void validate(T object)
      Validates the object
      Parameters:
      object - Object of type T
    • checkConstraints

      protected void checkConstraints(T object)
      Checks that no field constraints are violated in the object
      Parameters:
      object - The object of type T