Class NullValidatorHandler

java.lang.Object
info.ejava_student.starter.assignment3.aop.houserentals.NullValidatorHandler

public class NullValidatorHandler extends Object
  • Field Details

    • nullPropertyAssertion

      private final NullPropertyAssertion nullPropertyAssertion
    • target

      private final Object target
    • methodName

      private final String methodName
    • isNullProperties

      private final List<String> isNullProperties
    • nonNullProperties

      private final List<String> nonNullProperties
  • Constructor Details

    • NullValidatorHandler

      public NullValidatorHandler()
  • Method Details

    • invoke

      public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
      Implement the handler method invoked by the dynamic proxy interpose.
      Parameters:
      proxy -
      method - that was invoked by caller
      args - to the method invoked, supplied by caller
      Returns:
      value returned from target.method() call if args valid
      Throws:
      ClientErrorException.InvalidInputException - if args not valid
      Throwable
    • 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 with
      target - the object we are proxying
      methodName - method for the handler to process
      nullProperties - properties validated against isNull
      nonNullProperties - properties validated against notNull
      Returns:
      dynamic proxy implementing same interfaces as target