Class NullValidatorHandler
java.lang.Object
info.ejava_student.starter.assignment3.aop.houserentals.NullValidatorHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate final NullPropertyAssertionprivate final Object -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionImplement the handler method invoked by the dynamic proxy interpose.static <T> TnewInstance(NullPropertyAssertion nullPropertyAssertion, T target, String methodName, List<String> nullProperties, List<String> nonNullProperties) Creates a new dynamic interface proxy for target that will perform nullProperty assertion logic against provided objects for named methods.
-
Field Details
-
nullPropertyAssertion
-
target
-
methodName
-
isNullProperties
-
nonNullProperties
-
-
Constructor Details
-
NullValidatorHandler
public NullValidatorHandler()
-
-
Method Details
-
invoke
Implement the handler method invoked by the dynamic proxy interpose.- Parameters:
proxy-method- that was invoked by callerargs- to the method invoked, supplied by caller- Returns:
- value returned from target.method() call if args valid
- Throws:
ClientErrorException.InvalidInputException- if args not validThrowable
-
newInstance
public static <T> T newInstance(NullPropertyAssertion nullPropertyAssertion, T target, String methodName, List<String> nullProperties, List<String> nonNullProperties) Creates a new dynamic interface proxy for target that will perform nullProperty assertion logic against provided objects for named methods.- Type Parameters:
T- target object type- Parameters:
nullPropertyAssertion- validator for handler to validate withtarget- the object we are proxyingmethodName- method for the handler to processnullProperties- properties validated against isNullnonNullProperties- properties validated against notNull- Returns:
- dynamic proxy implementing same interfaces as target
-