/// <summary>
 /// Returns the given {@code deadlineName} and {@code messageOrPayload} as a DeadlineMessage which expires at the
 /// given {@code expiryTime}. If the {@code messageOrPayload} parameter is of type {@link Message}, a new
 /// {@code DeadlineMessage} instance will be created using the payload and meta data of the given message.
 /// Otherwise, the given {@code messageOrPayload} is wrapped into a {@code GenericDeadlineMessage} as its payload.
 /// </summary>
 /// <param name="deadlineName">A {@link String} denoting the deadline's name</param>
 /// <param name="messageOrPayload">A {@link Message} or payload to wrap as a DeadlineMessage</param>
 /// <param name="expiryTime">The timestamp at which the deadline expires</param>
 /// <typeparam name="T">The generic type of the expected payload of the resulting object</typeparam>
 /// <returns>a DeadlineMessage using the {@code deadlineName} as its deadline name and containing the given
 /// {@code messageOrPayload} as the payload</returns>
 public static IDeadlineMessage <T> AsDeadlineMessage(string deadlineName,
                                                      object messageOrPayload,
                                                      InternalDateTimeOffset expiryTime)
 {
     return(messageOrPayload is IMessage <T> message
         ? new GenericDeadlineMessage <T>(deadlineName, message,
                                          CachingSupplier <InternalDateTimeOffset> .Of(() => expiryTime))
         : new GenericDeadlineMessage <T>(deadlineName, new GenericMessage <T>((T)messageOrPayload),
                                          CachingSupplier <InternalDateTimeOffset> .Of(() => expiryTime)));
 }
 protected GenericEventMessage(IMessage <T> @delegate, InternalDateTimeOffset?timestamp)
     : this(@delegate, CachingSupplier <InternalDateTimeOffset> .Of(timestamp))
 {
 }