if (ref != null) {
// lookup in registry if ref provided
return CamelContextHelper.mandatoryLookup(context, ref, RedeliveryPolicy.class);
}
RedeliveryPolicy answer;
if (parentPolicy != null) {
answer = parentPolicy.copy();
} else {
answer = new RedeliveryPolicy();
}
// copy across the properties - if they are set
if (maximumRedeliveries != null) {
answer.setMaximumRedeliveries(maximumRedeliveries);
}
if (redeliveryDelay != null) {
answer.setRedeliveryDelay(redeliveryDelay);
}
if (retriesExhaustedLogLevel != null) {
answer.setRetriesExhaustedLogLevel(retriesExhaustedLogLevel);
}
if (retryAttemptedLogLevel != null) {
answer.setRetryAttemptedLogLevel(retryAttemptedLogLevel);
}
if (backOffMultiplier != null) {
answer.setBackOffMultiplier(backOffMultiplier);
}
if (useExponentialBackOff != null) {
answer.setUseExponentialBackOff(useExponentialBackOff);
}
if (collisionAvoidanceFactor != null) {
answer.setCollisionAvoidanceFactor(collisionAvoidanceFactor);
}
if (useCollisionAvoidance != null) {
answer.setUseCollisionAvoidance(useCollisionAvoidance);
}
if (maximumRedeliveryDelay != null) {
answer.setMaximumRedeliveryDelay(maximumRedeliveryDelay);
}
if (logStackTrace != null) {
answer.setLogStackTrace(logStackTrace);
}
if (logRetryStackTrace != null) {
answer.setLogRetryStackTrace(logRetryStackTrace);
}
if (logHandled != null) {
answer.setLogHandled(logHandled);
}
if (logContinued != null) {
answer.setLogContinued(logContinued);
}
if (logRetryAttempted != null) {
answer.setLogRetryAttempted(logRetryAttempted);
}
if (logExhausted != null) {
answer.setLogExhausted(logExhausted);
}
if (disableRedelivery != null && disableRedelivery) {
answer.setMaximumRedeliveries(0);
}
if (delayPattern != null) {
answer.setDelayPattern(delayPattern);
}
return answer;
}