private static RegisteredDelivery registeredDeliveryFromHeader(Message<?> msg) {
Object rd = valueIfHeaderExists(REGISTERED_DELIVERY_MODE, msg);
if (rd instanceof String) {
String rdString = (String) rd;
SMSCDeliveryReceipt smscDeliveryReceipt = SMSCDeliveryReceipt.valueOf(rdString);
Assert.notNull(smscDeliveryReceipt, "the registeredDelivery can't be null");
return new RegisteredDelivery(smscDeliveryReceipt);
}
if (rd instanceof SMSCDeliveryReceipt) {
SMSCDeliveryReceipt smscDeliveryReceipt = (SMSCDeliveryReceipt) rd;
return new RegisteredDelivery(smscDeliveryReceipt);
}
if (rd instanceof RegisteredDelivery) {
return (RegisteredDelivery) rd;