Skip to content

Commit

Permalink
Expose unwrap method on SmartValidator
Browse files Browse the repository at this point in the history
  • Loading branch information
rstoyanchev committed Aug 23, 2023
1 parent bf2cdcb commit 5bcb07c
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -64,4 +64,19 @@ default void validateValue(
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;
}

}

0 comments on commit 5bcb07c

Please sign in to comment.