/** * Check if a field is present then a second is also. If the twoWayDependency flag is set then the opposite must * also be true: if the second value is present, the first must also be. * * @param dependentName the name of the first field * @param dependentValue the value of the first field * @param name the name of the other field (which should be absent if the first is present) * @param value the value of the other field * @param twoWayDependency true if both depend on each other * @throws IllegalArgumentException if either condition is violated */ private void validateDependency(String dependentName, Object dependentValue, String name, Object value, boolean twoWayDependency) { if (isPresent(dependentValue) && !isPresent(value)) { throw new IllegalArgumentException("The field '" + dependentName + "' is not permitted on the step [" + this.name + "] because there is no '" + name + "'."); } if (twoWayDependency && isPresent(value) && !isPresent(dependentValue)) { throw new IllegalArgumentException("The field '" + name + "' is not permitted on the step [" + this.name + "] because there is no '" + dependentName + "'."); } }
/** * Validates that all components required to build a fault tolerant step are set */ protected void validateFaultTolerantSettings() { validateDependency("skippable-exception-classes", skippableExceptionClasses, "skip-limit", skipLimit, true); validateDependency("retryable-exception-classes", retryableExceptionClasses, "retry-limit", retryLimit, true); validateDependency("retry-listeners", retryListeners, "retry-limit", retryLimit, false); if (isPresent(processorTransactional) && !processorTransactional && isPresent(readerTransactionalQueue) && readerTransactionalQueue) { throw new IllegalArgumentException( "The field 'processor-transactional' cannot be false if 'reader-transactional-queue' is true"); } }
/** * Check if a field is present then a second is also. If the * twoWayDependency flag is set then the opposite must also be true: if the * second value is present, the first must also be. * * @param dependentName the name of the first field * @param dependentValue the value of the first field * @param name the name of the other field (which should be absent if the * first is present) * @param value the value of the other field * @param twoWayDependency true if both depend on each other * * @throws IllegalArgumentException if eiether condition is violated */ private void validateDependency(String dependentName, Object dependentValue, String name, Object value, boolean twoWayDependency) { if (isPresent(dependentValue) && !isPresent(value)) { throw new IllegalArgumentException("The field '" + dependentName + "' is not permitted on the step [" + this.name + "] because there is no '" + name + "'."); } if (twoWayDependency && isPresent(value) && !isPresent(dependentValue)) { throw new IllegalArgumentException("The field '" + name + "' is not permitted on the step [" + this.name + "] because there is no '" + dependentName + "'."); } }
/** * Check if a field is present then a second is also. If the twoWayDependency flag is set then the opposite must * also be true: if the second value is present, the first must also be. * * @param dependentName the name of the first field * @param dependentValue the value of the first field * @param name the name of the other field (which should be absent if the first is present) * @param value the value of the other field * @param twoWayDependency true if both depend on each other * @throws IllegalArgumentException if either condition is violated */ private void validateDependency(String dependentName, Object dependentValue, String name, Object value, boolean twoWayDependency) { if (isPresent(dependentValue) && !isPresent(value)) { throw new IllegalArgumentException("The field '" + dependentName + "' is not permitted on the step [" + this.name + "] because there is no '" + name + "'."); } if (twoWayDependency && isPresent(value) && !isPresent(dependentValue)) { throw new IllegalArgumentException("The field '" + name + "' is not permitted on the step [" + this.name + "] because there is no '" + dependentName + "'."); } }
/** * Check if a field is present then a second is also. If the twoWayDependency flag is set then the opposite must * also be true: if the second value is present, the first must also be. * * @param dependentName the name of the first field * @param dependentValue the value of the first field * @param name the name of the other field (which should be absent if the first is present) * @param value the value of the other field * @param twoWayDependency true if both depend on each other * @throws IllegalArgumentException if either condition is violated */ private void validateDependency(String dependentName, Object dependentValue, String name, Object value, boolean twoWayDependency) { if (isPresent(dependentValue) && !isPresent(value)) { throw new IllegalArgumentException("The field '" + dependentName + "' is not permitted on the step [" + this.name + "] because there is no '" + name + "'."); } if (twoWayDependency && isPresent(value) && !isPresent(dependentValue)) { throw new IllegalArgumentException("The field '" + name + "' is not permitted on the step [" + this.name + "] because there is no '" + dependentName + "'."); } }
/** * Check if a field is present then a second is also. If the twoWayDependency flag is set then the opposite must * also be true: if the second value is present, the first must also be. * * @param dependentName the name of the first field * @param dependentValue the value of the first field * @param name the name of the other field (which should be absent if the first is present) * @param value the value of the other field * @param twoWayDependency true if both depend on each other * @throws IllegalArgumentException if either condition is violated */ private void validateDependency(String dependentName, Object dependentValue, String name, Object value, boolean twoWayDependency) { if (isPresent(dependentValue) && !isPresent(value)) { throw new IllegalArgumentException("The field '" + dependentName + "' is not permitted on the step [" + this.name + "] because there is no '" + name + "'."); } if (twoWayDependency && isPresent(value) && !isPresent(dependentValue)) { throw new IllegalArgumentException("The field '" + name + "' is not permitted on the step [" + this.name + "] because there is no '" + dependentName + "'."); } }
private void validateFaultTolerantSettings() { validateDependency("skippable-exception-classes", skippableExceptionClasses, "skip-limit", skipLimit, true); validateDependency("retryable-exception-classes", retryableExceptionClasses, "retry-limit", retryLimit, true); validateDependency("retry-listeners", retryListeners, "retry-limit", retryLimit, false); if (isPresent(processorTransactional) && !processorTransactional && isPresent(readerTransactionalQueue) && readerTransactionalQueue) { throw new IllegalArgumentException( "The field 'processor-transactional' cannot be false if 'reader-transactional-queue' is true"); } }
/** * Validates that all components required to build a fault tolerant step are set */ protected void validateFaultTolerantSettings() { validateDependency("skippable-exception-classes", skippableExceptionClasses, "skip-limit", skipLimit, true); validateDependency("retryable-exception-classes", retryableExceptionClasses, "retry-limit", retryLimit, true); validateDependency("retry-listeners", retryListeners, "retry-limit", retryLimit, false); if (isPresent(processorTransactional) && !processorTransactional && isPresent(readerTransactionalQueue) && readerTransactionalQueue) { throw new IllegalArgumentException( "The field 'processor-transactional' cannot be false if 'reader-transactional-queue' is true"); } }
/** * Validates that all components required to build a fault tolerant step are set */ protected void validateFaultTolerantSettings() { validateDependency("skippable-exception-classes", skippableExceptionClasses, "skip-limit", skipLimit, true); validateDependency("retryable-exception-classes", retryableExceptionClasses, "retry-limit", retryLimit, true); validateDependency("retry-listeners", retryListeners, "retry-limit", retryLimit, false); if (isPresent(processorTransactional) && !processorTransactional && isPresent(readerTransactionalQueue) && readerTransactionalQueue) { throw new IllegalArgumentException( "The field 'processor-transactional' cannot be false if 'reader-transactional-queue' is true"); } }
/** * Validates that all components required to build a fault tolerant step are set */ protected void validateFaultTolerantSettings() { validateDependency("skippable-exception-classes", skippableExceptionClasses, "skip-limit", skipLimit, true); validateDependency("retryable-exception-classes", retryableExceptionClasses, "retry-limit", retryLimit, true); validateDependency("retry-listeners", retryListeners, "retry-limit", retryLimit, false); if (isPresent(processorTransactional) && !processorTransactional && isPresent(readerTransactionalQueue) && readerTransactionalQueue) { throw new IllegalArgumentException( "The field 'processor-transactional' cannot be false if 'reader-transactional-queue' is true"); } }