use of io.micronaut.inject.validation.BeanDefinitionValidator in project micronaut-core by micronaut-projects.
the class ValidatedBeanDefinition method validate.
/**
* Validates the bean with the validator factory if present.
*
* @param resolutionContext The resolution context
* @param instance The instance
* @return The instance
*/
default T validate(BeanResolutionContext resolutionContext, T instance) {
BeanDefinitionValidator validator = resolutionContext.getContext().getBeanValidator();
validator.validateBean(resolutionContext, this, instance);
return instance;
}
use of io.micronaut.inject.validation.BeanDefinitionValidator in project micronaut-core by micronaut-projects.
the class ValidatedBeanDefinition method validateBeanArgument.
/**
* Validates the given bean after it has been constructor.
*
* @param resolutionContext The resolution context
* @param injectionPoint The injection point
* @param argument The argument
* @param index The argument index
* @param value The value
* @param <V> The value type
* @throws BeanInstantiationException if the bean is invalid
*/
default <V> void validateBeanArgument(@NonNull BeanResolutionContext resolutionContext, @NonNull InjectionPoint injectionPoint, @NonNull Argument<V> argument, int index, @Nullable V value) throws BeanInstantiationException {
BeanDefinitionValidator validator = resolutionContext.getContext().getBeanValidator();
validator.validateBeanArgument(resolutionContext, injectionPoint, argument, index, value);
}
Aggregations