Expose unwrap method on SmartValidator

See gh-31082
This commit is contained in:
rstoyanchev 2023-08-22 11:01:32 +03:00
parent c6c61d6485
commit ff069de6d7
1 changed files with 16 additions and 1 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -64,4 +64,19 @@ public interface SmartValidator extends Validator {
throw new IllegalArgumentException("Cannot validate individual value for " + targetType);
}
/**
* Return a contained validator instance of the specified type, unwrapping
* as far as necessary.
* @param type the class of the object to return
* @param <T> the type of the object to return
* @return a validator instance of the specified type; {@code null} if there
* isn't a nested validator; an exception may be raised if the specified
* validator type does not match.
* @since 6.1
*/
@Nullable
default <T> T unwrap(@Nullable Class<T> type) {
return null;
}
}