title: Kotlin - Check if an object implements a specific interface
body: <p>Say I have some data class like:</p>
  
  <pre><code>data class NameCreated(
      val index: Float,
      val name: String
  ) : ESEventPayload
  </code></pre>
  
  <p>I then have some method where I want to return true if the Event's type in <code>&lt;Event&lt;out Any&gt;&gt;</code> is implementing <code>ESEventPayload</code>.</p>
  
  <p>So for example:</p>
  
  <pre><code>fun isItUsing(message: AcknowledgeableMessage&lt;Event&lt;out Any&gt;&gt;): Boolean =
  </code></pre>
  
  <p>I was hoping something like this would work, but it's not:</p>
  
  <pre><code>if (ESEventPayload::class.java.isAssignableFrom(message.body.payloadType::class.java)) {
     println("It's using the interface")
  } else {
     println("It isn't using")
  }
  </code></pre>
  
  <p>How do I go about doing this in Kotlin?</p>
  
  <p>Any help would be appreciated.</p>
  
  <p>Thanks.</p>