Is it possible to specify a static function in a Kotlin interface?
<p>I want to do something like this:</p>

<pre><code>interface Serializable&lt;FromType, ToType&gt; {
    fun serialize(): ToType
    companion object {
        abstract fun deserialize(serialized: ToType): FromType
    }
}
</code></pre>

<p>or even this would work for me:</p>

<pre><code>interface Serializable&lt;ToType&gt; {
    fun serialize(): ToType
    constructor(serialized: ToType)
}
</code></pre>

<p>but neither compiles. <strong>Is there a syntax for this, or will I be forced to use make this an interface for a factory?</strong> <sub>Or is there another answer?  That'd be neat!</sub></p>