Class MappedConstraintValidatorFactory

  • All Implemented Interfaces:
    javax.validation.ConstraintValidatorFactory

    public class MappedConstraintValidatorFactory
    extends Object
    implements javax.validation.ConstraintValidatorFactory
    ConstraintValidatorFactory to be used with compile-time Dependency Injection.
    • Constructor Detail

      • MappedConstraintValidatorFactory

        public MappedConstraintValidatorFactory()
    • Method Detail

      • addConstraintValidator

        public <T extends javax.validation.ConstraintValidator<?,​?>> MappedConstraintValidatorFactory addConstraintValidator​(Class<T> key,
                                                                                                                                   T constraintValidator)
        Adds validator as a singleton.
        Type Parameters:
        T - the type of constraint validator implementation
        Parameters:
        key - the constraint validator type
        constraintValidator - the constraint validator instance
        Returns:
        MappedConstraintValidatorFactory with the given constraint validator added.
      • addConstraintValidator

        public <T extends javax.validation.ConstraintValidator<?,​?>> MappedConstraintValidatorFactory addConstraintValidator​(Class<T> key,
                                                                                                                                   Supplier<T> constraintValidator)
        Adds validator as a non-singleton.
        Type Parameters:
        T - the type of constraint validator implementation
        Parameters:
        key - the constraint validator type
        constraintValidator - the constraint validator instance
        Returns:
        MappedConstraintValidatorFactory with the given constraint validator added.
      • getInstance

        public <T extends javax.validation.ConstraintValidator<?,​?>> T getInstance​(Class<T> key)
        Specified by:
        getInstance in interface javax.validation.ConstraintValidatorFactory
      • releaseInstance

        public void releaseInstance​(javax.validation.ConstraintValidator<?,​?> instance)
        Specified by:
        releaseInstance in interface javax.validation.ConstraintValidatorFactory