/** Validate request json for Create Session API and List Sessions API. */
 @Override
 public final void validate(final String method, final JsonObject requestBody)
     throws VtnServiceException {
   LOG.trace("Start SessionResourceValidator#validate()");
   LOG.info("Validating request for " + method + " of SessionResourceValidator");
   boolean isValid = false;
   isValid = validateUri();
   if (isValid && requestBody != null && VtnServiceConsts.GET.equals(method)) {
     isValid = validateGet(requestBody);
     updateOpParameterForList(requestBody);
   } else if (isValid && requestBody != null && VtnServiceConsts.POST.equals(method)) {
     isValid = validatePost(requestBody);
   } else if (isValid) {
     setInvalidParameter(VtnServiceConsts.INCORRECT_METHOD_INVOCATION);
     isValid = false;
   }
   // Throws exception if validation fails
   if (!isValid) {
     LOG.error("Validation failed");
     throw new VtnServiceException(
         Thread.currentThread().getStackTrace()[1].getMethodName(),
         UncJavaAPIErrorCode.VALIDATION_ERROR.getErrorCode(),
         UncJavaAPIErrorCode.VALIDATION_ERROR.getErrorMessage());
   }
   LOG.info("Validation successful");
   LOG.trace("Complete SessionResourceValidator#validate()");
 }
 /** Validate request Json object for get and post method of FlowFilterEntry API. */
 @Override
 public final void validate(final String method, final JsonObject requestBody)
     throws VtnServiceException {
   LOG.trace("Start FlowFilterEntriesResourceValidator#validate()");
   LOG.info("Validating request for " + method + " of FlowFilterEntriesResourceValidator");
   boolean isValid = false;
   try {
     isValid = validateUri();
     if (isValid && requestBody != null && VtnServiceConsts.GET.equals(method)) {
       isValid = validator.isValidGetForIntIndex(requestBody, isListOpFlag());
       setInvalidParameter(validator.getInvalidParameter());
       updateOpParameterForList(requestBody);
     } else if (isValid && requestBody != null && VtnServiceConsts.POST.equals(method)) {
       isValid = validatePost(requestBody);
       if (validator.getInvalidParameter() != null) {
         setInvalidParameter(validator.getInvalidParameter());
       }
     } else if (isValid) {
       setInvalidParameter(VtnServiceConsts.INCORRECT_METHOD_INVOCATION);
       isValid = false;
     }
   } catch (final NumberFormatException e) {
     if (validator.getInvalidParameter() != null) {
       setInvalidParameter(validator.getInvalidParameter());
     }
     LOG.error("Inside catch:NumberFormatException");
     isValid = false;
   } catch (final ClassCastException e) {
     if (validator.getInvalidParameter() != null) {
       setInvalidParameter(validator.getInvalidParameter());
     }
     LOG.error("Inside catch:ClassCastException");
     isValid = false;
   }
   // Throws exception if validation fails
   if (!isValid) {
     LOG.error("Validation failed");
     throw new VtnServiceException(
         Thread.currentThread().getStackTrace()[1].getMethodName(),
         UncJavaAPIErrorCode.VALIDATION_ERROR.getErrorCode(),
         UncJavaAPIErrorCode.VALIDATION_ERROR.getErrorMessage());
   }
   LOG.info("Validation successful");
   LOG.trace("Complete FlowFilterEntriesResourceValidator#validate()");
 }