Package org.springframework.data.util
Class NullnessMethodInvocationValidator
java.lang.Object
org.springframework.data.util.NullnessMethodInvocationValidator
- All Implemented Interfaces:
Advice
,Interceptor
,MethodInterceptor
- Direct Known Subclasses:
MethodInvocationValidator
Interceptor enforcing required return value and method parameter constraints declared on repository query methods.
Supports Kotlin nullness markers and JSR-305 Non-null annotations. Originally implemented via
MethodInvocationValidator
.- Since:
- 3.5
- Author:
- Mark Paluch, Johannes Englmeier, Christoph Strobl
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected RuntimeException
argumentIsNull
(Method method, String parameterName) Template method to construct aRuntimeException
indicating failure to provide a non-null value for a method parameter.invoke
(MethodInvocation invocation) protected RuntimeException
returnValueIsNull
(Method method) Template method to construct aRuntimeException
indicating failure to return a non-null return value.static boolean
Returns true if thetype
is supported by this interceptor.
-
Constructor Details
-
NullnessMethodInvocationValidator
public NullnessMethodInvocationValidator()
-
-
Method Details
-
supports
Returns true if thetype
is supported by this interceptor.- Parameters:
type
- the interface class.- Returns:
- true if the
type
is supported by this interceptor.
-
invoke
- Specified by:
invoke
in interfaceMethodInterceptor
- Throws:
Throwable
-
argumentIsNull
Template method to construct aRuntimeException
indicating failure to provide a non-null value for a method parameter.- Parameters:
method
-parameterName
-- Returns:
-
returnValueIsNull
Template method to construct aRuntimeException
indicating failure to return a non-null return value.- Parameters:
method
-- Returns:
-