/** * Check if model is non-null and array. * @param currentPath * @param model * @param ctx * @return false if current evaluation call must be skipped, true otherwise * @throws PathNotFoundException if model is null and evaluation must be interrupted * @throws InvalidPathException if model is not an array and evaluation must be interrupted */ protected boolean checkArrayModel(String currentPath, Object model, EvaluationContextImpl ctx) { if (model == null){ if (! isUpstreamDefinite()) { return false; } else { throw new PathNotFoundException("The path " + currentPath + " is null"); } } if (!ctx.jsonProvider().isArray(model)) { if (! isUpstreamDefinite()) { return false; } else { throw new PathNotFoundException(format("Filter: %s can only be applied to arrays. Current context is: %s", toString(), model)); } } return true; } }
/** * Check if model is non-null and array. * @param currentPath * @param model * @param ctx * @return false if current evaluation call must be skipped, true otherwise * @throws PathNotFoundException if model is null and evaluation must be interrupted * @throws InvalidPathException if model is not an array and evaluation must be interrupted */ protected boolean checkArrayModel(String currentPath, Object model, EvaluationContextImpl ctx) { if (model == null){ if (! isUpstreamDefinite()) { return false; } else { throw new PathNotFoundException("The path " + currentPath + " is null"); } } if (!ctx.jsonProvider().isArray(model)) { if (! isUpstreamDefinite()) { return false; } else { throw new PathNotFoundException(format("Filter: %s can only be applied to arrays. Current context is: %s", toString(), model)); } } return true; } }
/** * Check if model is non-null and array. * @param currentPath * @param model * @param ctx * @return false if current evaluation call must be skipped, true otherwise * @throws PathNotFoundException if model is null and evaluation must be interrupted * @throws InvalidPathException if model is not an array and evaluation must be interrupted */ protected boolean checkArrayModel(String currentPath, Object model, EvaluationContextImpl ctx) { if (model == null){ if (! isUpstreamDefinite()) { return false; } else { throw new PathNotFoundException("The path " + currentPath + " is null"); } } if (!ctx.jsonProvider().isArray(model)) { if (! isUpstreamDefinite()) { return false; } else { throw new PathNotFoundException(format("Filter: %s can only be applied to arrays. Current context is: %s", toString(), model)); } } return true; } }