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 RuntimeExceptionargumentIsNull(Method method, String parameterName) Template method to construct aRuntimeExceptionindicating failure to provide a non-null value for a method parameter.invoke(MethodInvocation invocation) protected RuntimeExceptionreturnValueIsNull(Method method) Template method to construct aRuntimeExceptionindicating failure to return a non-null return value.static booleanReturns true if thetypeis supported by this interceptor.
-
Constructor Details
-
NullnessMethodInvocationValidator
public NullnessMethodInvocationValidator()
-
-
Method Details
-
supports
Returns true if thetypeis supported by this interceptor.- Parameters:
type- the interface class.- Returns:
- true if the
typeis supported by this interceptor.
-
invoke
- Specified by:
invokein interfaceMethodInterceptor- Throws:
Throwable
-
argumentIsNull
Template method to construct aRuntimeExceptionindicating failure to provide a non-null value for a method parameter.- Parameters:
method-parameterName-- Returns:
-
returnValueIsNull
Template method to construct aRuntimeExceptionindicating failure to return a non-null return value.- Parameters:
method-- Returns:
-